[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

redirecting stderr to memory



Hello!

Is there an easy way to redirect stderr to memory?
I was thinking about something like:

  FILE *stream,*tmpstream;
  char *streambuf;
  size_t streamsize;

  stream=open_memstream(&streambuf,&streamsize);
  tmpstream=stderr;
  stderr=stream;

but it doesn't work, because stderr is not a FILE* in libc6.

Any ideas?

(I need that to display messages directed to stderr from busybox when
linked to a Slang program, as in:

Slang program: 
redirect stderr to memory buffer
call mount_fn from busybox 
	mount_fn failed, error message to stderr
redirect stderr to the tty again
display error message 
).

	Thanks,
-- 
Enrique Zanardi						   ezanardi@ull.es
Dpto. Fisica Fundamental y Experimental			Univ. de La Laguna


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: