Отв.: Отв.: Отв.: r+b filemode
Oleg Moroz
oleg_moroz at yahoo.com
Sat May 28 18:51:55 UTC 2011
________________________________
От: Chris Johns <chrisj at rtems.org>
Кому: Oleg Moroz <oleg_moroz at yahoo.com>
Копия: "rtems-users at rtems.org" <rtems-users at rtems.org>
Отправлено: суббота, 28 май 2011 3:23
Тема: Re: Отв.: Отв.: r+b filemode
Returning us to the list.
On 27/05/11 7:33 PM, Oleg Moroz wrote:
> i'm using rfs.
Thanks.
Which version of RTEMS are you using ?
Chris
> ------------------------------------------------------------------------
> *От:* Chris Johns <chrisj at rtems.org>
> *Кому:* Oleg Moroz <oleg_moroz at yahoo.com>
> *Копия:* Joel Sherrill <joel.sherrill at oarcorp.com>;
> "rtems-users at rtems.org" <rtems-users at rtems.org>
> *Отправлено:* пятница, 27 май 2011 11:38
> *Тема:* Re: Отв.: r+b filemode
>
> On 27/05/11 3:00 PM, Oleg Moroz wrote:
> >
> >
> > ------------------------------------------------------------------------
> > *От:* Joel Sherrill <joel.sherrill at oarcorp.com
> <mailto:joel.sherrill at oarcorp.com>>
> > *Кому:* Oleg Moroz <oleg_moroz at yahoo.com
> <mailto:oleg_moroz at yahoo.com>>; "rtems-users at rtems.org
> <mailto:rtems-users at rtems.org>"
> > <rtems-users at rtems.org <mailto:rtems-users at rtems.org>>
> > *Отправлено:* четверг, 26 май 2011 21:57
> > *Тема:* Re: r+b filemode
> >
> > Which filesystem?
> >
> > Do you have a complete small test case?
> >
> > Someone else will likely have other ideas. I am on travel and just
> > wanted to ask the obviuous questions.
> >
> > --joel
> >
> > Oleg Moroz <oleg_moroz at yahoo.com <mailto:oleg_moroz at yahoo.com>
> <mailto:oleg_moroz at yahoo.com <mailto:oleg_moroz at yahoo.com>>> wrote:
> >
> > >Hello everyone, i have a trouble with opening file. i have opened the
> > file with "wb" mode. Write to it 512 bytes. close it. after this open it
> > with "r+b" mode. then trying:
> > >
> > >///
> > >fseek(file,0,SEEK_END);
> > >int i = ftell(file);
> > >///
> > >
> > >
> > >
> > >after this i=0
> > >
> > >but when i'm opening file with "rb" mode - i=512. how i can use "r+b"
> > mode?
> >
> > int create_ring_buffer_file(char *filename)
> > {
> > FILE* outfile=fopen(filename,"wb");
> >
> > if (outfile==NULL) return -1;
> >
> > char *block=(char *)malloc(512);
> > memset(block,0,512);
> >
> > fwrite(block,512,1,outfile);
> > free(block);
> > fclose(outfile);
> > outfile=fopen(filename,"r+b");
> > fseek(outfile,0,2);
> > int i = ftell(outfile); //i=0
> > fclose(outfile);
> >
> > outfile=fopen(filename,"rb");
> > fseek(outfile,0,2);
> > int i = ftell(outfile); //i=512
> > fclose(outfile);
> > return 0;
> > }
> >
>
> Which file system are you using ?
>
> Chris
>
>
i'm using RTEMS 4.10
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20110528/e44412e2/attachment-0001.html>
More information about the users
mailing list