File Input Output

Hello C++ pros,

Question:
I am trying to find a way, to store two strings into a file example

"Test" " " "Test"
"Test2" " " "Test2"
and so on, as every instance of the program keeps going, although
every time the instance goes, the global storage filename for that, it just goes back to go one line, and it does not keep adding string and string\n

Thanks
Code:
https://github.com/Gr33nAl13n/file_testing
> ofstream openfile2; openfile2.open(usersfirstlast);
http://www.cplusplus.com/reference/fstream/ofstream/open/
I'm guessing you're looking to open the file in append mode.

FWIW, putting multiple statements on a line makes it harder to read.

And don't put using namespace std; in header files.
1
2
3
4
5
6
7
8
9
10
11
#pragma once
#ifndef user_information_h
#define user_information_h
#include <iostream>
#include <cstring>
#include <string>
//!! using namespace std;

class user_info {
private:
	std::string passcode;  //!! fully qualified namespace here 

When you start creating your own namespaces, and other people start using your code, then careful namespace usage becomes important.


thank you salem c I will modify the header for namespace, and try append mode.
Topic archived. No new replies allowed.