You're not trying very hard -- this discourages folks from helping.
Code:
#include <stdio.h>
int main(void)
{
static const char filename[] = "file.txt";
FILE *file = fopen(filename, "r");
if ( file != NULL )
{
char line[BUFSIZ];
while ( fgets(line, sizeof line, file) != NULL )
{
printf("first character on the line: '%c'\n", line[0]);
}
fclose(file);
}
else
{
perror(filename);
}
return 0;
}
/* my output
first character on the line: 'M'
first character on the line: 'J'
first character on the line: 'J'
first character on the line: 'T'
first character on the line: 'B'
first character on the line: 'M'
*/
Help us help you by posting your attempt.