April 03, 2004 Problems opening a file | ||||
|---|---|---|---|---|
| ||||
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).
| ||||
April 03, 2004 Re: Problems opening a file | ||||
|---|---|---|---|---|
| ||||
Posted in reply to kinghajj | 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! | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply