On May 31, 3:20*am, A Moose in Love <parkstreetboo...@gmail.com>
wrote:
> I need to know in a simple way, how to create files, open them, write
> to them, save them, and close them. *I've googled and have come up
> with information that doesn't seem to work. *For example:
> // basic file operations
> #include <iostream>
> #include <fstream>
> using namespace std;
>
> int main () {
> * ofstream myfile;
> * myfile.open ("example.txt");
> * myfile << "Writing this to a file.\n";
> * myfile.close();
> * return 0;
>
> }
>
> This does not work. *I cannot find a file after running this little
> program called 'example.txt'.
> I'm not a programmer; I just need to do this.
Being not a programmer is OK, but do you at least know what operating
system and C++ compiler you are using? With that information available
people might be able to help you to find that "example.txt" of yours.
|