Re: fseek and open_memstream
- From: mark_bluemel@xxxxxxxxx
- Date: 31 Jan 2007 09:15:51 -0800
On 31 Jan, 16:08, Dmitry Belous <dmitry_bel...@xxxxx> wrote:
Why when I uncomment fseek line buf become empty?
#define _GNU_SOURCE
#include <stdio.h>
int main() {
char *buf = 0;
int size = 0;
FILE* f = open_memstream(&buf, &size);
fwrite("test", 1, 4, f);
// fseek(f, 0, SEEK_SET);
fclose(f);
fprintf(stderr, buf);}
<Off-topic>
The non-standard open_memstream() function, from the online man pages
I've viewed, allows you to treat a character buffer as an output
stream to which you can write.
Seeking back to the beginning is presumably regarded as preparation to
write again, so in effect it clears the buffer.
For more information, I suggest you use a GNU libraries newsgroup or
mailing list.
</Off-topic>
.
- Follow-Ups:
- Re: fseek and open_memstream
- From: Richard Tobin
- Re: fseek and open_memstream
- References:
- fseek and open_memstream
- From: Dmitry Belous
- fseek and open_memstream
- Prev by Date: Re: fseek and open_memstream
- Next by Date: variable initialization / I'm a n00b
- Previous by thread: Re: fseek and open_memstream
- Next by thread: Re: fseek and open_memstream
- Index(es):
Relevant Pages
|