How is string from ... different from string from a file ?

2011-12-12 Thread ParticlePeter
Hi, I have a hard time reading in a string from a file. I don't get any compile time or run time errors, but my application does not work reliably when I read a string from a file. But when I define the same string within my code, everything runs perfect, allways. The string I want to use is

Re: How is string from ... different from string from a file ?

2011-12-12 Thread Timon Gehr
On 12/12/2011 03:35 PM, ParticlePeter wrote: Hi, I have a hard time reading in a string from a file. I don't get any compile time or run time errors, but my application does not work reliably when I read a string from a file. But when I define the same string within my code, everything runs

Re: How is string from ... different from string from a file ?

2011-12-12 Thread bearophile
Timon Gehr: string fragString = readText( Shader.vert ) ~ '\0'; I think using toStringz is more self-documenting. Bye, bearophile

Re: How is string from ... different from string from a file ?

2011-12-12 Thread Timon Gehr
On 12/12/2011 06:37 PM, bearophile wrote: Timon Gehr: string fragString = readText( Shader.vert ) ~ '\0'; I think using toStringz is more self-documenting. Bye, bearophile There is nothing more self-documenting than actually appending the zero. Claiming toStringz is better in that regard

Re: How is string from ... different from string from a file ?

2011-12-12 Thread Steven Schveighoffer
On Mon, 12 Dec 2011 12:59:11 -0500, Timon Gehr timon.g...@gmx.ch wrote: On 12/12/2011 06:37 PM, bearophile wrote: Timon Gehr: string fragString = readText( Shader.vert ) ~ '\0'; I think using toStringz is more self-documenting. Bye, bearophile There is nothing more self-documenting than

Re: How is string from ... different from string from a file ?

2011-12-12 Thread ParticlePeter
Thank you very much, you made my day, that was it :-) Cheers, ParticlePeter ! OpenGL probably wants a zero-terminated string. It works if you add the code as a literal because string literals are zero-terminated. string fragString = readText( Shader.vert ) ~ '\0'; Alternatively, you can