![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Question about output to file | beeloo | Shell Programming and Scripting | 1 | 04-25-2008 03:20 PM |
| wget output question | sertansenturk | UNIX for Dummies Questions & Answers | 1 | 04-19-2008 12:01 PM |
| display and output...question | happyv | Shell Programming and Scripting | 5 | 01-25-2007 02:14 AM |
| Question on prtdiag output ... | luft | UNIX for Dummies Questions & Answers | 5 | 11-14-2006 12:27 PM |
| Further question on 'ifconfig' output | mint1981 | UNIX for Dummies Questions & Answers | 1 | 09-10-2002 11:49 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
A question about output.
I am learning output the data to a file using "ofstream". I need to read data from a file and output the result to the other file in 2 different ways. To do that I have to provoke two functions, and they have to output the result to the same text file. My problem is: they are correct on the screen (output first function and then the second), but when they output to the text file, the second one always erras or cover the first one.
I think it might because after the first function finished, the second function open the file again and output from the beginning. How can I make it begin from the end of first function's output? Here is my code: #include <iostream> using namespace std; void functionOne() { ... ofstream outfile("a.txt"); outfile << data << data ...; } void functionTwo() { ... ofstream outfile("a.txt"); outfile << data << data ...; } int main() { ... functionOne(); ... functionTwo(); ... return 0; } |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|