# Quick file-writing question

This topic is 3824 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I've got a function that is trying to write information out to a file:
	fstream fInFile("pwds.txt", ios::out|ios::app);
if (!fInFile.is_open()){
return false;
}

else{
fInFile << endl;
fInFile << newClient.userName << "," << newClient.pWord;
sendString(iSocket, "true");

return true;


this writes fine, but it won't take a newline when writing to the file no matter where I put "endl". so where I would want username,password username2,password2 I get username,passwordusername2,password2 which won't work with what I want to do. Could someone tell me wher I'm going wrong? I was sure "endl" made it take a newline when writing to a file.

• 16
• 11
• 9
• 9
• 49
• ### Forum Statistics

• Total Topics
631392
• Total Posts
2999740
×