Home > Back-end >  MFC generated dynamically TXT file
MFC generated dynamically TXT file

Time:09-29

Use fopen () dynamically generate TXT file, why my name display only one character at a time, and also not TXT format that is why,
Can also generate TXT file name?
TCHAR train_now [41]={0}, train_pre [42]={0};
GetDlgItemText (IDC_EDIT2 train_now, 41);
for(j=0; j<41. J++)
{
If (train_now [j]=='\ 0')
break;
}
//MessageBox (trainnow);
The FILE * pFile, * pFile1;
If (fopen (" instruction set. TXT ", "r")==NULL)//instruction set. TXT there is no
{
PFile=fopen (" instruction set. TXT ", "w");//create a file "instruction set. TXT"
Train_now [j + 1)='\ n';//behind the n adds a newline
Fwrite (train_now, 2, j + 2, pFile); Will train with the end of the logo//command string write "of" instruction set. TXT file
The fclose (pFile);//close "instruction set. TXT file

Train_now [j + 1)=';
Train_now [m + 2]='t'.
Train_now + 3 [j]='x';
Train_now [j + 4]='t'.
Train_now + 5 [j]='\ 0';

//const char * pName=train_now (char *);
Fopen (train_now (char *), "w +");//w + for write and read operations opens an empty file, if the given file exists already, then the content will be empty
  • Related