Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!philabs!micomvax!musocs!mcgill-vision!mouse From: mouse@mcgill-vision.UUCP Newsgroups: comp.unix.questions,comp.unix.wizards,comp.lang.c Subject: Re: argv ==> stdin (fast) Message-ID: <561@mcgill-vision.UUCP> Date: Sat, 22-Nov-86 19:29:42 EST Article-I.D.: mcgill-v.561 Posted: Sat Nov 22 19:29:42 1986 Date-Received: Mon, 24-Nov-86 19:30:17 EST References: <2972@rsch.WISC.EDU> Organization: McGill University, Montreal Lines: 30 Xref: linus comp.unix.questions:152 comp.unix.wizards:136 comp.lang.c:119 In article <2972@rsch.WISC.EDU>, mcvoy@rsch.WISC.EDU (Lawrence W. McVoy) writes: > So, I'm stuck. Does anyone have a cute way to feed a short byte stream > to stdin backwards? Or a better solution? I'm not willing to do > anything as kludgey as [shell script hack] This situation is made-to-order for one of my stdio extensions: FILE *fopenstr(str,len,mode) char *str; int len; char *mode; which produces a stdio stream which reads from or writes into (according as mode is "r" or "w") the given string. For BSD systems at least, this is easy (I believe someone already posted pretty much what is necessary). I don't know how easy it would be on a USG system. There's also fopenfxn(), which makes stdio call a specified function whenever it wants a character - with this you can build anything you want. der Mouse USA: {ihnp4,decvax,akgua,utzoo,etc}!utcsri!mcgill-vision!mouse think!mosart!mcgill-vision!mouse Europe: mcvax!decvax!utcsri!mcgill-vision!mouse ARPAnet: think!mosart!mcgill-vision!mouse@harvard.harvard.edu [USA NSA food: terrorist, cryptography, DES, drugs, CIA, secret, decode]