Re: textfile

From: Jakob Olsen (jakobols_at_tiscali.dk)
Date: 05/11/04


Date: Tue, 11 May 2004 16:07:22 +0200


// ofstream::open
#include <fstream>
using namespace std;

int main()
{
 ofstream outfile;

  outfile.open ("test.txt", ofstream::out | ofstream::app);
  outfile << "WORD1\tNAVN1\nWORD2\tNAVN2\n";
  outfile.close();

  return 0;
}
"BjoernJackschina" <jacksch_1@hotmail.com> wrote in message
news:a24000a2.0405110300.52ec6400@posting.google.com...
> Hello,
> I just want to write something in a textfile. It should have this
structure:
> word "\t" word1 "\n"
> word2 "\t" word3 "\n"
> and so on.
> What is the source code for this example?
> Many thanks



Relevant Pages

  • Potential bug with ofstream in linux
    ... using namespace std; ... int main ... Temprol Configuration File ...
    (comp.unix.programmer)
  • Re: input and output questions about file
    ... using namespace std; ... junk.c:5: warning: type defaults to `int' in declaration of `std' ... junk.c:10: `string' undeclared ... junk.c:12: parse error before '/' token ...
    (comp.lang.c)
  • Re: Comparing files (Fast)
    ... I didn't knew what is was, but using fseek solved the problem. ... I'm using a timer utility Scott Meyers wrote for use ... > using namespace std; ... > int ch1,ch2; ...
    (comp.lang.cpp)
  • Re: return memory to the OS
    ... > 4 using namespace std; ... > 5 int main ... > possible to make STL return this memory to the OS (say using a system ... :: "out of confusion comes chaos -- out of chaos comes confusion and fear ...
    (comp.lang.cpp)
  • Re: Huge Floating Point Error
    ... using namespace std; ... int main ... floating point math is different from integer math. ...
    (microsoft.public.dotnet.languages.vc)