Help with simple C program
Help with simple C program
- Subject: Help with simple C program
- From: Isaac Rivera <email@hidden>
- Date: Sat, 4 Sep 2004 18:54:00 -0400
When running the program below and entering the path to file which
contains the following text:
This is a test...
I get the pipe characther "|" as a result. This is true if I read
additional characters. They all print to "|".
I wrote the text file named "copyme" in pico.
Thanks!
Isaac
// Read characters from a file:
#include <stdio.h>
int main (void)
{
char inName[64];
FILE *in;
int c;
// get file names from the user;
printf("\nEnter the name of the file to be copied: ");
scanf("cs", inName);
// open input and output files:
if((in = fopen(inName, "r")) == NULL)
{
printf("Can't open %s for reading.\n", inName);
return 1;
}
// get the first character of in:
c == getc(in);
printf("c = %c\n", c);
// Close open files:
fclose(in);
return 0;
}
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.