the problem is it writes 'a' as '1' first in the text then it should writes'2' in the text but it writes '12' how can i make it delete the previous number in the file and write ther new number? I used
pFile = fopen ("myfile.txt","w");
this code in C but i want to write it in C++ libraries and codes to learn c++. And i use DevC++
Sorry for bad english
As for overwriting text in a file:
Use : file.open ("Source.txt", ios::in | ios:: out | ios::trunc)
ios::in will make the file open for input. ios::out will make the file open for output. ios::trunc will make the program overwrite the previous data in the file.