我要獲取test和1這倆行的字串然后保存到陣列里面 怎么操作???
uj5u.com熱心網友回復:
可以用基本的C函式 fopen fgets fclose
#include <stdio.h>
void main( void )
{
FILE *stream;
char line[100];
if( (stream = fopen( "fgets.c", "r" )) != NULL )
{
if( fgets( line, 100, stream ) == NULL)
printf( "fgets error\n" );
else
printf( "%s", line);
fclose( stream );
}
}
uj5u.com熱心網友回復:
編譯不了阿。。。。。uj5u.com熱心網友回復:
CStdioFile txtIn;if(!txtIn.Open(TransFile,CFile::modeRead |
CFile::typeText | CFile::shareDenyNone))
{
AfxMessageBox("無法打開檔案!");
return;
}
CString OneLine;
while(txtIn.ReadString(OneLine))
{
OneLine.Empty();
}
txtIn.Close();
uj5u.com熱心網友回復:
按文本檔案處理即可轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/68676.html
標籤:基礎類
上一篇:mfc 免安裝程式
