how to use the open() call

P

pal

Hi,

How to use the open() ( mean syntax ) to open a file and to append the
data every time at the end of the file.


My Problem is,

I created a file and written some data into it, and second time i
opened the file with the open() like
fd = open ("\dir\file.dat",O_WRONLY,0); and written some data into
this file.

But always I am not able to append the data to the file.instead it is
overwriting the file.
Is there any way to solve this problem .


Thanks.
 
M

Martin Ambuhl

pal said:
Hi,

How to use the open() ( mean syntax ) to open a file and to append the
data every time at the end of the file.

Unfortunately, open() is not a standard C call, and its meaning, syntax,
and attendant issues are determined by the implementation that you are
using. It is likely that that is a Unix-like one, in which case a Unix
(or Posix or Linux) newsgroup is the right one. The usual Posix/Unix
open() yields an int called a file-descriptor, which is not the way
streams are referenced in the standard C library. There the similar
call is fopen() which yields pointer-to-FILE. If you have trouble using
the standard C functions, this is the place. If your problem is with an
implementation-specific function like open(), this is not the place for it.
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top