Correct headers will be called.....
If you only need one, why not just show it?
I can't use any other functions than those above.
It is unfortunate that you would be required to use
gets.
Code is much easier to read when it is within [code][/code]
int main(){
char filename[30];
FILE *in;
printf("Enter file you wish to open\n");
gets(filename); /* eeeeeah */
in = fopen(filename,"r");
printf("%s", 'in'); /* 'in' is not a valid character, not a valid string, nor a valid file */
/* Let's assume that you are trying to read from a file. First, don't write to it. */
/* You should be using fgets to get a string from a file or the stdin */
if (in == NULL) { /* a little late for the check if you're already attempting to mess with it above */
printf("Error could not open %s\n", filename);
exit(1);
}
}
Reputation Points: 2780
Solved Threads: 312
long time no c
Offline 4,790 posts
since Apr 2004