Re: [std.file] dirEntries

2011-12-12 Thread Vladimir Panteleev
On Monday, 12 December 2011 at 14:43:38 UTC, Tobias Pankrath wrote: I can't see, what I'am doing wrong. Can anyone help? You can't do this only using a glob. The glob syntax used by dirEntries is described here: http://dlang.org/phobos/std_path.html#globMatch You can do this with std.algori

Restrict access to "critical" functions

2011-12-12 Thread Christian Köstlin
Hi, I want to restrict the access of a piece of d2-code to just some functions I declare allowed. E.g. I would like to forbid all access to io and prevent the program to format my hd. Or even better I would like to tell D2 which functions of the std-libraries are allowed, all other functions sho

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,

Re: [std.file] dirEntries

2011-12-12 Thread Adam
I'm not sure if it's a different RegEx pattern than other languages, but you may wish to try: temp_[^\.]* [] typically indicates a character class or set of characters. ^ is used to indicate unallowed / exception characters . will typically need to be escaped, depending on context.

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 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 actually append

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 regar

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 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 p

Re: Reading in files as int/float array or one String/char[] ( OpenGL Data )

2011-12-12 Thread Simon
On 12/12/2011 09:31, ParticlePeter wrote: Hi, I read several posts about reading in files, but I can't find the "best" way for my purpose. I am using std.file in the examples bellow. 1.) I'm trying to read an OpenGL Vertex and Fragment Shader. The wired thing on my approach is that it works .

[std.file] dirEntries

2011-12-12 Thread Tobias Pankrath
Hello, I'm struggling with std.file.dirEntries. I want iterate over every file below a directory, which name starts with "test_" and does not contain a point ("."). I've tried this, but it does not work: -- foreach(DirEntry de; dirEntries("myDir", "temp_[!.]*", SpanMode.breadth)) { wri

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 an

Re: Reading in files as int/float array or one String/char[] ( OpenGL Data )

2011-12-12 Thread Kagamin
2.) I am reading in Vertex Data from a file. It holds only floats, e.g.: -38.3887 97.7612 -10.5231 -38.3572 98.8543 -10.5064 ... There is no metadata in the file giving information about the count of values. 3.) When reading a file line by line it would be nice to have the count of Lines of the

Re: Reading in files as int/float array or one String/char[] ( OpenGL Data )

2011-12-12 Thread bearophile
ParticlePeter: > auto fileFrag = cast( GLchar[] )readText( "Shader/Shader_01.frag" ) ; > const GLchar * fragSource = cast( GLchar * )fileFrag ; Avoid raw casts every time it is possible. The second cast is not necessary, using the ".ptr". > I use a dynamic array, and append each line to my

Re: Reading in files as int/float array or one String/char[] ( OpenGL

2011-12-12 Thread ParticlePeter
Andrej Mitrovic Wrote: > I have a funky feeling you're reading NeHe? Try this: THX, that's very cool, will definitly look deeper into these samples. I know NeHe, but am following The OpenGL Book, and using DerelictSDL. This shows me how you do it, but does not answer my questions, my Shader Iss

Re: Reading in files as int/float array or one String/char[] ( OpenGL Data )

2011-12-12 Thread Andrej Mitrovic
I have a funky feeling you're reading NeHe? Try this: https://github.com/AndrejMitrovic/DNeonHelium/blob/master/Samples/win32/lesson25.d#L87

Reading in files as int/float array or one String/char[] ( OpenGL Data )

2011-12-12 Thread ParticlePeter
Hi, I read several posts about reading in files, but I can't find the "best" way for my purpose. I am using std.file in the examples bellow. 1.) I'm trying to read an OpenGL Vertex and Fragment Shader. The wired thing on my approach is that it works ... sometimes, but sometimes the Shaders cann