This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
JFFS2 fseek
- From: eibach at gdsys dot de
- To: ecos-discuss at ecos dot sourceware dot org
- Date: 25 Mar 2004 14:25:25 UT
- Subject: [ECOS] 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