That line variable is different than the one you use in inOut. Since it's a local variable, and you don't initialize it or put any useful data in it, it contains garbage, hence your nonsense characters.
Originally Posted by geustuser
I don't know what you mean by this, and I'm not sure you do either. A prototype just tells the compiler about a function (parameters and return type), so it can make sure you use it right. This is only needed if you call the function before you define it (like how you call getOpen in main, but define getOpen after main). The compiler reads from top to bottom and only knows about stuff it's already seen (things above it in the file).
I'm thinking maybe a prototype function is the way to go.
Those two red lines are prototypes, not function calls. Take them out. Never put a prototype inside a function. The belong where you have the others, above your functions (green text). Also, as I mentioned, the line variable in main is different from the one in inOut. You need to declare one in main, and pass it in to inOut. Note that line is declared as a single array of chars, thus it can only hold one line at a time. If you need to hold several lines, you need an array of array of chars:
void inOut(FILE *);
char convert(char *);
char textprint(char *);
outFile = getOpen();
printf("The File was successuflly written.\n");
char convert(char );
char textprint(char *line);
fprintf(outFile, "%s\n", line); // print to file
That should get you going for a bit.
char line; // declare line to be an array of 5 "lines", each "line" having room for 80 chars plus the terminating null.
inOut(outFile, line); // pass line into inOut
convert(line); // converts the first line to upper case, do this for all lines, using a loop
void inOut(FILE *fname, char line)
printf("Please enter five lines of text:\n");
for (count = 0; count < 5; count++)
fgets(line[count], 81, stdin); // gets is bad, see the FAQ
fprintf(fname, "%s\n", line);