Sign in to follow this  

Quick file-writing question

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;

		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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this