D - Problems opening a file
- kinghajj (15/15) Apr 02 2004 here's the problem-code:
- Manfred Nowak (6/8) Apr 02 2004 [...]
here's the problem-code: this(String s,char *m) { if( (file = fopen(s.strGet(),m)) == nullf) { printf("ERROR: Could not open file."); assert(0); } } It's a constructor of a class 'File'; 'String' is another class. strGet() returns the string, variable type 'string' (char[]). I can't see what's wrong with this, but whenever I try to open a file like this I get the error "ERROR: Could not open file.". nullf is a file used for comparison between the two files (to see if there's a problem).
Apr 02 2004
kinghajj wrote: [...]if( (file = fopen(s.strGet(),m)) == nullf)[...]returns the string, variable type 'string' (char[])[...] Probably fopen expects a C string ( char*) not a D string (char[]). So long!
Apr 02 2004