Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

LINUX File Handling Limitations

I am encountering an interesting problem. I am developing applications in C and am opening files using the fopen command under the "a" option. I am attempting to do this with four files and the executable is overwriting the files instead of appending them. Is there some file handling limitation in LINUX that might be causing this and how to I hack my way past it.

Thanks....

Comments

  • gautamgautam Posts: 642Member
    : I am encountering an interesting problem. I am developing applications in C and am opening files using the fopen command under the "a" option. I am attempting to do this with four files and the executable is overwriting the files instead of appending them. Is there some file handling limitation in LINUX that might be causing this and how to I hack my way past it.
    :
    : Thanks....
    :

    Hi,
    Have you tried "a+" ?
  • paladinpaladin Posts: 97Member
    : : I am encountering an interesting problem. I am developing applications in C and am opening files using the fopen command under the "a" option. I am attempting to do this with four files and the executable is overwriting the files instead of appending them. Is there some file handling limitation in LINUX that might be causing this and how to I hack my way past it.
    : :
    : : Thanks....
    : :
    :
    : Hi,
    : Have you tried "a+" ?
    :
    I attempted to use the "a+" option, but the same thing happens. I am assuming the file pointer resets to EOF each time the file is sequentially opened. If this assumption is bad, let me know. I will attempt to reset the file pointer to EOF each time, but I think my assumption is correct. I am thinking the answer is to go into LINUX as sysadmin and allocate more disk space to myself. Have you ever had to do that or know how to do it? I am not having much luck w/ my LINUX references on that one.
  • Jeff P.Jeff P. Posts: 196Member
    : : : I am encountering an interesting problem. I am developing applications in C and am opening files using the fopen command under the "a" option. I am attempting to do this with four files and the executable is overwriting the files instead of appending them. Is there some file handling limitation in LINUX that might be causing this and how to I hack my way past it.
    : : :
    : : : Thanks....
    : : :
    : :
    : : Hi,
    : : Have you tried "a+" ?
    : :
    : I attempted to use the "a+" option, but the same thing happens. I am assuming the file pointer resets to EOF each time the file is sequentially opened. If this assumption is bad, let me know. I will attempt to reset the file pointer to EOF each time, but I think my assumption is correct. I am thinking the answer is to go into LINUX as sysadmin and allocate more disk space to myself. Have you ever had to do that or know how to do it? I am not having much luck w/ my LINUX references on that one.
    :

  • Jeff P.Jeff P. Posts: 196Member
    Maybe you can find out if the problem is in Linux, or in your code by trying
    to append a file from a different program - like maybe bash ?


    echo 'first line' > test.txt
    echo 'second line' >> test.txt
    cat test.txt

Sign In or Register to comment.