ofstream help needed

E

ern

Is there a good example of simple usage of ofstream ?

Also, I need to create a FOLDER before I create a file to write to. Is
this possible ? If so, how ?
 
E

ern

ern said:
Is there a good example of simple usage of ofstream ?

Also, I need to create a FOLDER before I create a file to write to. Is
this possible ? If so, how ?

ok... just found out ofstream isn't part of the C languange, but it
would still help if someone has advice using ofstream (or a C
alternative).
 
M

Michael Mair

ern said:
Is there a good example of simple usage of ofstream ?

Also, I need to create a FOLDER before I create a file to write to. Is
this possible ? If so, how ?

Try comp.lang.c++; I've heard people say it were down to
the hall and to the left. ofstream certainly does not belong
to standard _C_ as discussed here.

Cheers
Michael
 
M

Michael Mair

ern said:
ok... just found out ofstream isn't part of the C languange, but it
would still help if someone has advice using ofstream (or a C
alternative).

Directories are not part of standard C.
You can wrap potential ugliness such as making a call via
system() away in a portability module.

If you want to work with "files" in C, you use <stdio.h>;
-> FILE, fopen(), fclose(), and, depending on your use,
either fread()/fwrite() or fgets()/fputs() or getc/putc or
fscanf()(not really)/fprintf().


Cheers
Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top