?
2010-01-09 06:10:20 UTC
other than letters shouldn't be changed). The user will supply the name of the input file on the
command line:
toupper test.doc
Have toupper write its output to stdout.
ive send that question before but the answers got are not working.Here is the one i've written(below). therre is no error when compiling and when running the window,it appears and disappears very quickly. If i've made any mistake, please correct it. write the line.
#include
#include
#include
int main(int argc, char *argv[])
{
FILE *fp;
int ch;
if (argc != 2) {
fprintf(stderr, "usage: toupper file\n");
exit(EXIT_FAILURE);
}
if ((fp = fopen(argv[1], "r")) == NULL) {
fprintf(stderr, "Can't open %s\n", argv[1]);
exit(EXIT_FAILURE);
}
while ((ch = getc(fp)) != EOF)
putchar(toupper(ch));
fclose(fp);
system("PAUSE");
return 0;
}