Hello, all!
How can I print some text into a .txt or .bat file?
I use C++ with Virsual Studio 2008. I tryed on Google, those results in there didn't help...
- realchamp.
Printable View
Hello, all!
How can I print some text into a .txt or .bat file?
I use C++ with Virsual Studio 2008. I tryed on Google, those results in there didn't help...
- realchamp.
Here is an algorithm:
1. Open a new file
2. Copy the content of the old file into the new file up to the place where you want to insert your text
3. Write your text to the new file
4. Copy the rest of the old file to the new file
5. Close the new file
6. Remove the old file
7. Rename the new file with the name of the old file
Another algorithm is possible if the file is smaller than your available memory:
1. Read the entire file into memory
2. Write data from memory up to the place where you want to insert your text
3. Write your text
4. Write the end of your data from memory
http://www.google.com.au/search?hl=en&q=C%2B%2B+file+input+output&btnG=Google+Search&meta=&aq=f&oq=
What were your search terms?
It's very convenient to become familiar with what terms to use. Good books will better your terminology.