Jump to content
  • Advertisement
Sign in to follow this  
PiCroft

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.

If you intended to correct an error in the post then please contact us.

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()){
		cout << "Password file not found!" << endl;
		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.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!