Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!brutus.cs.uiuc.edu!wuarchive!emory!hubcap!grimlok From: grimlok@hubcap.clemson.edu (Mike Percy) Newsgroups: comp.lang.c Subject: Macro help Message-ID: <8284@hubcap.clemson.edu> Date: 8 Mar 90 20:10:39 GMT Organization: Clemson University, Clemson, SC Lines: 16 Awhile back I saw some code which used a macro that had a do...while(0) loop in it. At the time I thought, hey that's a good idea, but now that I need to do something while could use this I'm stuck. Here's my situation: I am reading chars. When I hit '\n' I need to skip the first 6 chars on the next line ( anyone guess why?) and return the next char. Effectively this removing all "\nxxxxxx" from the stream. I tried this: #define input(ch) \ ((ch) = getchar) != '\n' ? (ch) : \ (do { int i = 5; while(i--) (void) getchar(); } while(0);), getchar() But this doesn't seem to work. Anyone that can help me out there?