This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

JFFS2 fseek


Hello,

I have a problem with the following code:

fp = fopen("/jffs2/sys/testfile","w");
fseek(fp, 512, SEEK_SET);
fputs("End\n", fp);
stat = fseek(fp, 0, SEEK_SET);
fputs("Begin\n", fp);
fclose(fp);

It should produce testfile:
Begin
<free space>
End

Instead it produces:
End
Begin
<free space>

I had some debugging and found that fseek is executed immedeatly, but fputs is executed when the file is closed.

The following code is a workaround:

fp = fopen("/jffs2/sys/testfile","w");
fseek(fp, 512, SEEK_SET);
fputs("End\n", fp);
fflush(fp);
stat = fseek(fp, 0, SEEK_SET);
fputs("Begin\n", fp);
fflush(fp);
fclose(fp);

So something seems to be terribly wrong with fseek. Any suggestions where to start searching?

Regards,
Dirk


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]