Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFile question....please help

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
How would I take a CString and write it to a file??
 
To get a String and write it to a file, a sequence of function calls such as this would work:
1> cin ;input the string from the user
2> fopen ;open a file where you would store the string
3> fwrite ;write the string into the file
4> fclose ;close the file
and you are done!

 
try this out:

CFile testfile("C:\\testing123.txt", CFile::modeCreate|CFile::modeNoTruncate|CFile::modeReadWrite);

CString buff="hello world";
testfile.Write(buff,lstrlen(buff));
testfile.Close();
-=$umedha=-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top