quote:Original post by Craazer
How can i store strings to a file?
u see if i have:
string name="McCall";
and i store it to file using ofstream, its just numbers in the file so obviously its kinda difficult to load from the file.
Soo does the string type have any operator perhaps to get chars, not the memory address or what ever it gaved to me?
Just be more careful when your string consist of empty spaces. Reading is slightly different when there's empty spaces in between your string. IMO, writting-out and reading-in line-by-line is the easiest. See also getline() or fgets().
[EDIT] Oh, your solution has been mentioned above (in C and C++ both version), so I needn't repeat it here.
[edited by - DerekSaw on December 23, 2002 10:33:57 PM]