digitalmars.D - String to binary conversion
- clearion (4/4) Sep 03 2014 I would like to write binary data to a file for an ancillary hash
- ketmar via Digitalmars-d (2/2) Sep 03 2014 crossposting annoys people and decreases your chances to get the
- clearion (3/5) Sep 03 2014 maybe it was an accident as I am new to this forum
- ketmar via Digitalmars-d (4/5) Sep 03 2014 it's impossible to accidentally cross-post to "general", "announce" and
- clearion (6/12) Sep 03 2014 I accidentally posted to announce, then immediately posted to
- Vladimir Panteleev (10/23) Sep 03 2014 There is more overlap between these forums and Stack Overflow
- Gary Willoughby (5/10) Sep 03 2014 Please can we politely direct newcomers to D.learn with a welcome
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (11/20) Sep 03 2014 Agreed. :)
- Philippe Sigaud via Digitalmars-d (2/5) Sep 03 2014 Or even: "Learning D"
- HeiHon (5/12) Sep 04 2014 +1
- monarch_dodra (3/9) Sep 04 2014 Not *that* common. Heck, I find it's rare compared to a lot of
- Nick Sabalausky (3/10) Sep 05 2014 I'd suggest a box, with a colored background, near the top saying:
- Vladimir Panteleev (8/16) Sep 07 2014 OK, done. But I think this is the fourth time I'm changing the
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (3/7) Sep 07 2014 Thank you! :) This solves the issue.
- Andrei Alexandrescu (2/7) Sep 07 2014 BTW all of the forum should go on our repo on github. -- Andrei
- Adam D. Ruppe (5/5) Sep 03 2014 You could just write the string length then the data to the file
- clearion (3/8) Sep 03 2014 Thanks Mr. Ruppe. I'll give it a try
- Colin (13/19) Sep 03 2014 I think this:
I would like to write binary data to a file for an ancillary hash table operation and then read it back using stream.rawRead(). How would I go about converting a string to binary in D. I would prefer not to use any third party libraries if I can. Thank You
Sep 03 2014
crossposting annoys people and decreases your chances to get the answer.
Sep 03 2014
On Wednesday, 3 September 2014 at 12:43:01 UTC, ketmar via Digitalmars-d wrote:crossposting annoys people and decreases your chances to get the answer.maybe it was an accident as I am new to this forum
Sep 03 2014
On Wed, 03 Sep 2014 12:44:29 +0000 clearion via Digitalmars-d <digitalmars-d puremagic.com> wrote:maybe it was an accident as I am new to this forumit's impossible to accidentally cross-post to "general", "announce" and "stackoverflow".
Sep 03 2014
On Wednesday, 3 September 2014 at 12:49:22 UTC, ketmar via Digitalmars-d wrote:On Wed, 03 Sep 2014 12:44:29 +0000 clearion via Digitalmars-d <digitalmars-d puremagic.com> wrote:I accidentally posted to announce, then immediately posted to general. Stackoverflow has nothing to do with this forum as I have my own presence there. You are expending alot of energy being critical rather than trying to helpmaybe it was an accident as I am new to this forumit's impossible to accidentally cross-post to "general", "announce" and "stackoverflow".
Sep 03 2014
On Wednesday, 3 September 2014 at 12:52:21 UTC, clearion wrote:On Wednesday, 3 September 2014 at 12:49:22 UTC, ketmar via Digitalmars-d wrote:There is more overlap between these forums and Stack Overflow than you might think. It's unlikely that you'll get a D-related answer on Stack Overflow from someone who is not a regular on these forums. However, digitalmars.D.learn has much more activity than Stack Overflow. Considering that you are more likely to get an answer there, I find it ironic that you've posted your question everywhere EXCEPT the place where you'd most likely get an answer, and then get upset when people point that out.On Wed, 03 Sep 2014 12:44:29 +0000 clearion via Digitalmars-d <digitalmars-d puremagic.com> wrote:I accidentally posted to announce, then immediately posted to general. Stackoverflow has nothing to do with this forum as I have my own presence there. You are expending alot of energy being critical rather than trying to helpmaybe it was an accident as I am new to this forumit's impossible to accidentally cross-post to "general", "announce" and "stackoverflow".
Sep 03 2014
On Wednesday, 3 September 2014 at 12:43:01 UTC, ketmar via Digitalmars-d wrote:crossposting annoys people and decreases your chances to get the answer.it's impossible to accidentally cross-post to "general", "announce" and "stackoverflow".Please can we politely direct newcomers to D.learn with a welcome instead of chewing them out. These people are probably unfamiliar with these newsgroups.
Sep 03 2014
On 09/03/2014 10:36 AM, Gary Willoughby wrote:On Wednesday, 3 September 2014 at 12:43:01 UTC, ketmar via Digitalmars-d wrote:Agreed. :) To Vladimir: Can we move digitalmars.D.learn to the top of the forums at forum.dlang.org? I would even put it in its separate area on that page with larger font, etc. :) Also, I've just noticed that "Questions about learning D" sounds a little off because it sounds as if the questions should be like "how can I learn D". :) How about something like "Questions when learning D". Thank you, Alicrossposting annoys people and decreases your chances to get the answer.it's impossible to accidentally cross-post to "general", "announce" and "stackoverflow".Please can we politely direct newcomers to D.learn with a welcome instead of chewing them out. These people are probably unfamiliar with these newsgroups.
Sep 03 2014
On Wed, Sep 3, 2014 at 7:59 PM, Ali Çehreli <digitalmars-d puremagic.com> wrote:Also, I've just noticed that "Questions about learning D" sounds a little off because it sounds as if the questions should be like "how can I learn D". :) How about something like "Questions when learning D".Or even: "Learning D"
Sep 03 2014
Can we move digitalmars.D.learn to the top of the forums at forum.dlang.org? I would even put it in its separate area on that page with larger font, etc. :)+1 Given that it seems quite common for newbies to not ask their first questions in D.learn.Also, I've just noticed that "Questions about learning D" sounds a little off because it sounds as if the questions should be like "how can I learn D". :) How about something like "Questions when learning D".Or "Here you find answers to your questions when/while learning D" (Not a native speaker here)
Sep 04 2014
On Thursday, 4 September 2014 at 14:43:03 UTC, HeiHon wrote:Not *that* common. Heck, I find it's rare compared to a lot of other forums. I think the current setup is fine.Can we move digitalmars.D.learn to the top of the forums at forum.dlang.org? I would even put it in its separate area on that page with larger font, etc. :)+1 Given that it seems quite common for newbies to not ask their first questions in D.learn.
Sep 04 2014
On 9/3/2014 1:59 PM, Ali Çehreli wrote:To Vladimir: Can we move digitalmars.D.learn to the top of the forums at forum.dlang.org? I would even put it in its separate area on that page with larger font, etc. :) Also, I've just noticed that "Questions about learning D" sounds a little off because it sounds as if the questions should be like "how can I learn D". :) How about something like "Questions when learning D".I'd suggest a box, with a colored background, near the top saying: Need help using D? Ask in <a href="...">D.learn</a>!
Sep 05 2014
On Wednesday, 3 September 2014 at 17:59:24 UTC, Ali Çehreli wrote:Can we move digitalmars.D.learn to the top of the forums at forum.dlang.org?OK, done. But I think this is the fourth time I'm changing the layout. Hopefully this will be the last.I would even put it in its separate area on that page with larger font, etc. :)Let's see how far this gets us before messing with font sizes and colors.Also, I've just noticed that "Questions about learning D" sounds a little off because it sounds as if the questions should be like "how can I learn D". :) How about something like "Questions when learning D".The descriptions are from the DigitalMars news server. Do you think I should change the local copy on the forum? It will no longer be the same as the actual newsgroup description.
Sep 07 2014
On 09/07/2014 02:45 PM, Vladimir Panteleev wrote:On Wednesday, 3 September 2014 at 17:59:24 UTC, Ali Çehreli wrote:Thank you! :) This solves the issue. AliCan we move digitalmars.D.learn to the top of the forums at forum.dlang.org?OK, done.
Sep 07 2014
On 9/7/14, 2:45 PM, Vladimir Panteleev wrote:On Wednesday, 3 September 2014 at 17:59:24 UTC, Ali Çehreli wrote:BTW all of the forum should go on our repo on github. -- AndreiCan we move digitalmars.D.learn to the top of the forums at forum.dlang.org?OK, done. But I think this is the fourth time I'm changing the layout. Hopefully this will be the last.
Sep 07 2014
You could just write the string length then the data to the file using the .length and index things on string. file.write(mystr.length); file.write(mystr); // should automatically write out all the bytes of the string
Sep 03 2014
On Wednesday, 3 September 2014 at 12:47:06 UTC, Adam D. Ruppe wrote:You could just write the string length then the data to the file using the .length and index things on string. file.write(mystr.length); file.write(mystr); // should automatically write out all the bytes of the stringThanks Mr. Ruppe. I'll give it a try
Sep 03 2014
On Wednesday, 3 September 2014 at 12:33:49 UTC, clearion wrote:I would like to write binary data to a file for an ancillary hash table operation and then read it back using stream.rawRead(). How would I go about converting a string to binary in D. I would prefer not to use any third party libraries if I can. Thank YouI think this: void main(){ string str = "Test string"; auto file = File("output.txt", "w"); auto bin = cast(ubyte[])str; foreach(b; bin){ file.writef("%b", b); } file.close(); } will do it? This is untested though....
Sep 03 2014