On Sep 2, 2008, at 7:48 PM, Clark Cox wrote:
What do you need to know this for?
Fristly, thank you for answering.
It's an exercise in K&R ( C programming language) (p 153) showing how to use input/output in C.
So, if a program called "upper" is called, the code is this.
>>>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
int main (int argc, const char * argv[]) {
int c;
if (strcmp(argv[0], "upper")==0)
while ( (c = getchar() ) != EOF)
putchar(toupper(c));
else
putchar(tolower(c));
return 0;
}
<<<<<<<
Using Xcode (3.1), I am trying to call this from the terminal, but not having too much success. And, the exercises will be a lot more fun if I can actually get them to work!!!