Re: code question
Barry Schwarz wrote:
Most things "Bill" posts are at least slightly odd...
--
Ian Collins.
Barry Schwarz wrote:
On Fri, 19 Sep 2008 16:52:17 -0400, "Bill Cunningham"
<nospam@nspam.i nvalidwrote:
>
>
So the fourth command line argument should be a number.
>
>
At the same time, it should be a file name.
>
That doesn't strike you as slightly odd?
>
<nospam@nspam.i nvalidwrote:
>
> I have this code I would like to clean up.
>>
>#include <stdio.h>
>#include <stdlib.h>
>>
>int main(int argc, char *argv[])
>{
> double x, y, a, b;
> FILE *fp;
> x = strtod(argv[1], NULL);
> y = strtod(argv[2], NULL);
> a = strtod(argv[3], NULL);
> b = strtod(argv[4], NULL);
>>
>#include <stdio.h>
>#include <stdlib.h>
>>
>int main(int argc, char *argv[])
>{
> double x, y, a, b;
> FILE *fp;
> x = strtod(argv[1], NULL);
> y = strtod(argv[2], NULL);
> a = strtod(argv[3], NULL);
> b = strtod(argv[4], NULL);
So the fourth command line argument should be a number.
>
> if ((fp = fopen(argv[4], "a")) == NULL) {
At the same time, it should be a file name.
>
That doesn't strike you as slightly odd?
>
--
Ian Collins.
Comment