[c++ Win32] Edit Control avec fopen
Salut,
Question sûrement stupide mais, je n’arrive pas depuis ce matin à afficher un texte « .txt » dans IDC_EDIT1 (Edit Control)
Mon problème, c’est le retour à la ligne et la détection de la fin du fichier.
Dans le fichier test.txt :
0 0 0
0 1 1
1 0 1
1 1 0
et le programme :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| char temp[800];
int i=0;
char c;
const char* fichier;
fichier="test.txt";
FILE* fp = NULL;
fp = fopen(fichier,"r");
while (( c=fgetc(fp)) !=EOF)
{
//if(c=='\0') temp[i++]='\r\n';
temp[i++]=c;
}
if(fp) fclose(fp);
SetWindowText(GetDlgItem(hdlg,IDC_EDIT1),temp); |
merci beaucoup
@+