Hey,
I have a file containing the number 1. I want to make a program that reads the number in the file, and then replaces the number incremented by 1.
so far I have this, but it does not seem to work, the file remains unchanged
file:Code:int number; fstream file; file.open("number.txt"); file >> number; file.close(); file.open("number.txt", ios::trunc); file << number+1; file.close();
CheersCode:1