Код:

char s[50];
while (! feof (f))
{
s[0] = 0; // не забываем инициализировать
AfxMessageBox (CString (fgets (s, sizeof(s), f)));
};
Syntax
#include <stdio.h>
char *fgets(char *s, int n, FILE *stream);
wchar_t *fgetws(wchar_t *s, int n, FILE *stream); // Unicode version
Description
Gets a string from a stream.
fgets reads characters from stream into the string s. The function stops reading when it reads either n - 1 characters or a newline character whichever comes first. fgets retains the newline character at the end of s. A null byte is appended to s to mark the end of the string.
Return Value
On success fgets returns the string pointed to by s; it returns NULL on end-of-file or error.