I have created a library which has a portion of code similar to following
int a;
a = 5;
std::ofstream outFile("File.txt");
outFile << "Values : " << std::endl;
outFile << a << std::endl;
Now, this library is used by two different process which outputs File.txt
with two different outputs
Output 1 :
Values :
Ouptut 2 :
Values :
5
I've found some resources where its mentioned to pass integers to streams by converting to strings using std::to_string
(Converting integer to string in c++) . But I want to know what makes the two processes act differently in the same scenario. It feels like as if one of the process do some changes to the streams in a global state