first i tried this
Code:
int main()
{
fstream file("hello.txt");
file<<"hello"<<endl;
file.close();
}
and it didnt even make a file.
then i tried
Code:
fstream file;
file.open("hello.txt");
and that did nothing
so then i tried
Code:
int main()
{
fstream file;
file.open("hello.txt");
file.write("hey", 3);
file.close();
}
and it still didnt even make a file
then i tried
Code:
int main()
{
fstream file;
file.open("hello.txt", ios::out);
file<<"hey"<<endl;
file.close();
}
and it worked !! but when i changed it to
file.open("hello.txt", ios:ut | ios::in );
it doesnt work...
so i guess my new question is how do i make a fstream that reads and writes