Skip to main content
gamedev.net
🔒 Locked

cant write strings to file ?

Started by PlagueViper May 11, 2003 at 10:08 AM 2 replies 250+ views
Original Post
PlagueViper
PlagueViper
when i try to write strings (std::string from string.h) to files i get this error: C:\Program Files\Microsoft Visual Studio\MyProjects\DATParseCRC32\main.cpp(8) : error C2679: binary ''<<'' : no operator defined which takes a right-hand operand of type ''class std::basic_string,class std::allocator< char> >'' (or there is no acceptable conversion) my code is:
  
ifstream fin("original.dat");ofstream fout("parsed.dat");string token;fout << token; 
  
i guess fout is made to write only data types in iostream, but i can cout strings so i should be able to fout them. please help.
---Linux: Smashing Windows and opening doors~PlagueViper
quant
quant
the correct header file is string not string.h, .h is for c strings ( and thats cstring ).

[edited by - quant on May 11, 2003 11:21:44 AM]
-keyboard
PlagueViper
PlagueViper
I LOVE YOU GUYS!!!!! errr.... not really but thx
---Linux: Smashing Windows and opening doors~PlagueViper

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.