Article View: comp.sys.ibm.pc.programmer
Article #1323Re: redirection indicated in argc
From: Ralf.Brown
Date: Fri, 16 Feb 1990 15:10
Date: Fri, 16 Feb 1990 15:10
28 lines
1676 bytes
1676 bytes
In article <1022@wubios.wustl.edu>, david@wubios.wustl.edu (David J. Camp) wrote:
}I was using Microsoft C, and had a program that used command line
}arguments and read the standard input. When I specified:
}
} command arg1 arg2 ... argn-1 < filename
}
}The argc variable reflected the presence of the filename.
}i.e. it had the value n+1.
}When I specified:
}
} type filename | command arg1 arg2 ... argn-1
}
}it was not indicated, i.e. it had the value n. I think this must
}be a compiler bug. -David-
DOS doesn't strip any whitespace preceding the redirection characters, so
I would guess that the startup code is seeing the blank following argn-1
and assuming that there is another argument, which turns out to be empty.
Try adding a blank to the send of your second example; it should set argc to
n+1.
--
UUCP: {ucbvax,harvard}!cs.cmu.edu!ralf -=- 412-268-3053 (school) -=- FAX: ask
ARPA: ralf@cs.cmu.edu BIT: ralf%cs.cmu.edu@CMUCCVMA FIDO: Ralf Brown 1:129/46
"How to Prove It" by Dana Angluin Disclaimer? I claimed something?
14. proof by importance:
A large body of useful consequences all follow from the proposition in
question.
Technical Details
Message-ID:
<25dc25ed@ralf>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!tut.cis.ohio-state.edu!pt.cs.cmu.edu!b.gp.cs.cmu.edu!Ralf.Brown@B.GP.CS.CMU.EDUShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!tut.cis.ohio-state.edu!pt.cs.cmu.edu!b.gp.cs.cmu.edu!Ralf.Brown@B.GP.CS.CMU.EDU From: Ralf.Brown@B.GP.CS.CMU.EDU Newsgroups: comp.sys.ibm.pc.programmer Subject: Re: redirection indicated in argc Message-ID: <25dc25ed@ralf> Date: 16 Feb 90 15:10:21 GMT Sender: ralf@b.gp.cs.cmu.edu Organization: Carnegie Mellon University School of Computer Science Lines: 28 In-Reply-To: <1022@wubios.wustl.edu>