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

ParticlePeter ParticlePeter at gmx.de
Mon Dec 12 06:35:35 PST 2011


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 OpenGL Shader, but the problem is not to be related to OpenGL as far as a I see. 
Are there some format strings which I need to get rid of, and how ?

I tried:
import std.file ;
string fragString = readText( "Shader.vert" ) ;

import std.file , std.utf ;
string fragString = toUTF8( readText( "Shader.vert" ) ) ;

import std.stdio ;
string text = "" ;
auto file = File( "Shader.vert" ) ;
foreach( line ; file.byLine() )  string ~= strip( to!( string )( line ) ) ;

What else could I try ?

Cheers, ParticlePeter !



More information about the Digitalmars-d-learn mailing list