Somehow fstream doesn’t read my input from a file.
int main()
{
ifstream fin("duomenys.txt");
ofstream fout("rezultatas.txt");
int n = 0;
fin >> n;
cout << n << endl;
fout.close();
fin.close();
return 0;
}
duomenys.txt
24
The output here is 0. I can’t figure out why this doesn’t work..
The path is relative to the process’s working directory, which may not be the same as the executable location.
Use an absolute path to confirm that you have a path issue, and then go on to find the proper relative path to use if you wish.