I wasn't aware that C's I/O functions worked with CString objects. Perhaps a C-style string used as a buffer would be better suited if you're not going to use MFC I/O:
Code:
void CPoetryEditorDlg::OnOpenFile()
{
// TODO: Add your control notification handler code here
FILE *fp;
char buf[BUFSIZ];
poem.Empty();
author.Empty();
dt.Empty();
title.Empty();
pb.Empty();
fp = fopen(file, "r");
if(fp == NULL){
AfxMessageBox("Unable to open file for reading!");
return;
}
//fseek(fp, 0L, SEEK_SET); Not needed, you're at the beginning already.
fscanf(fp, "%s", buf);
title = buf;
fscanf(fp, "%s", buf);
author = buf;
fscanf(fp, "%s", buf);
dt = buf;
fscanf(fp, "%s", buf);
pb = buf;
fclose(fp);
}