Team 2550
Technical Documentation
|
|
Everything that can be done with iostream
can also be used with files through the fstream
header. However, there are a few things that you need to handle manually. Here are the necessary steps...
cin
and cout
are actually treated as files (especially on UNIX systems). The only difference is that they are automatically opened and closed.\n
is faster than endl
due to the fact that it has less overhead.The output file will look like this...
2 4 8 16 32 64 128 256 512 1024
file.txt
will be created in the working directory. The working directory is where the command line (console) is looking when the file is executed. Typically, it will be either your home folder or the location that the file was executed.