how to use the open() call

Discussion in 'C Programming' started by pal, Aug 19, 2008.

  1. pal

    pal Guest

    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.
    pal, Aug 19, 2008
    #1
    1. Advertising

  2. pal wrote:
    > 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.
    Martin Ambuhl, Aug 19, 2008
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Shilpa
    Replies:
    1
    Views:
    6,025
    Anubhav Jain
    Mar 22, 2006
  2. THY
    Replies:
    4
    Views:
    490
    Gönen EREN
    Aug 22, 2003
  3. TC
    Replies:
    3
    Views:
    3,270
  4. Clare Hsiao
    Replies:
    11
    Views:
    245
    Michael Winter
    Feb 13, 2004
  5. Torsten Mohr
    Replies:
    6
    Views:
    100
    Martien Verbruggen
    Dec 31, 2003
Loading...

Share This Page