home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ferkel.ucsb.edu!ucsbcsl!network.ucsd.edu!usc!cs.utexas.edu!asuvax!ennews!envmsa.eas.asu.edu!ptran
- From: ptran@envmsa.eas.asu.edu (Phi-Long Tran)
- Newsgroups: comp.lang.c
- Subject: Re: Kwik escape from recursive loop, Possible?
- Message-ID: <29AUG199221255122@envmsa.eas.asu.edu>
- Date: 30 Aug 92 04:25:00 GMT
- References: <1992Aug29.221941.20788@eng.ufl.edu>
- Sender: news@ennews.eas.asu.edu (USENET News System)
- Distribution: usa
- Organization: Arizona State University, Tempe, AZ
- Lines: 23
- News-Software: VAX/VMS VNEWS 1.4-b1
-
- In article <1992Aug29.221941.20788@eng.ufl.edu>,
- zzang@whale.uucp (Zhuo Zang[~{j0WA~}]) writes...
-
- > I am writing a program. In the program, I use a 'while (c!=EOF)'
- > statement to write char. I also have a recursive call to get input char
- > in the program, this caused problem. the recursive call piles up a huge
- > stack when the c finally reaches the EOF; then it returns one by one, so
- > my output file ended with many(48 in one eg.) EOF's (the 0xff in DOS).
-
- Does the input routine have to be recursive? If possible, find an
- iterative solution.
-
- > my question is: is it possible to escape from the loop immediately
- > without returning the garbages once c reaches the EOF ?
-
- Look up the documentation for the functions "setjmp" and "longjmp" in
- the C library (I think the names are correct). They allow you to perform
- non-local GOTO's.
-
- ---
- Phi-Long Tran
- ptran@asuvax.eas.asu.edu
- Arizona State University
-