Thread View: comp.sys.ibm.pc.programmer
1 messages
1 total messages
Started by Ralf.Brown
Fri, 16 Feb 1990 15:10
Re: redirection indicated in argc
Author: 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.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads