LINUX File Handling Limitations - Programmers Heaven

Howdy, Stranger!

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

Categories

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.