Howdy, Stranger!

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

Categories

working with files & structure

while writing a structure into a file using fwrite i get some junk values written along with the original value.
how to overcome it
i used sizeof(struct structurename) to find the length of bytes to be written into a file

Comments

  • AsmGuru62AsmGuru62 Member Posts: 6,519
    : while writing a structure into a file using fwrite i get some junk values written along with the original value.
    : how to overcome it
    : i used sizeof(struct structurename) to find the length of bytes to be written into a file
    :
    :
    [blue]fread()/fwrite() is for binary files, so they should not be readable. If you read the same structure with the same sizeof() - all information is preserved.

    If you need the text file to use - then use different functions for this: fgets()/fputs().[/blue]
Sign In or Register to comment.