Home > Software engineering >  MFC how to obtain CFG configuration file inside the string
MFC how to obtain CFG configuration file inside the string

Time:09-23

I want to get the test and 1 this two lines of the string and then save the array inside how to operate???????

CodePudding user response:

Can use the basic C fopen () function fgets fclose

 

# include & lt; Stdio. H>

Void main (void)
{
The FILE * stream;
Char line [100].

If ((stream=fopen (" the fgets. C ", "r"))!=NULL)
{
If (the fgets (line, 100, stream)==NULL)
Printf (" the fgets error \ n ");
The else
Printf (" % s ", line);
The fclose (stream);
}
}

CodePudding user response:

Don't compile,,,,,,,

CodePudding user response:

CStdioFile txtIn;
if(! TxtIn. Open (TransFile, CFile: : modeRead |
CFile: : typeText | CFile: : shareDenyNone))
{
AfxMessageBox (" unable to open file!" );
return;
}
Cstrings OneLine.
While (txtIn. ReadString (OneLine))
{
OneLine. Empty ();
}
TxtIn. Close ();

CodePudding user response:

According to the text file processing
  • Related