Hi there.
Thanks for your replies. yes, I did include <stdio.h>. Not sure about the namespace, i think Bloodshed Dev++ is a straight out of the box compiler.
Here's the code in case it helps:
Code:
#include <stdio.h>
const char filename[] = "dump.txt";
int words = 0;
// Declare filenames and word count
int main()
{
FILE * f = fopen(filename, "r");
// Open the test file dump.txt
int c = fgetc(f);
// use fgetc to read characters from the file
if(c != "\crlf") [
printf("%x",c);
// Cycle through file, if alpha characters print
} else {
printf("\n");
// Otherwise if spaces or line break print new line
words++;
// Increment word count based on spaces and line break
}
fclose(f);
printf("This document contains");
printf("%d",words);
printf("words");
return 0;
}
The program is one to read from a text file and print out a list of the words, using spaces and line breaks as separaters.
There seem to be some errors around lines 12, 17 and 21, relating to the pointer and to undefined variables, but I can't find the variables that are apparently causing the error. That having been said, i don't see what any of the above has to do with the printf statements..
Thanks again for taking a look at this, I appreciate it and am happy to learn.
Hussein.