string FileName; //is global variable defined elsewhere eg could be "c:test.txt"
string *Name;//tried char as well just in case.
Name=&FileName;
InFile.open(*Name,ios::in|ios::binary|ios::ate);
gives me an error in open() probably because of the string pointer but is expecting a char pointer. I don't know why and I am not familiar with C++ errors.
In delphi I think you could do pchar(filename) from memory or something but is there a function to convert the FileName into a form that will be acceptable to use in open ()?
If someone could help me with this would appreciate it.
this is a miss in the language because file.open predates strings, there needs to be an overload for open(string, stuff) added.
string is NOT a char*.
string is a somewhat bloated class that contains a char*. And for the most part, you can avoid actually tapping the char* piece, but this is one place there isn't a better way.