[C 平台] 我有一个文本文件和文本文件的第一行为“校准(版本 6.0.26.54947)”我需要忽略字符“校准(版本)”并只读取数字“6.0.26.54947”。
我有以下代码并继续......任何人都可以帮助我。
// open a file
pFile = fopen("text.txt", "r" );
if ( pFile == NULL ) {
WriteToErrorWin("ERROR: Can not open the file!");
return ( -1 );
}
// get a file size
fseek(pFile, 0 , SEEK_END);
lFileSize = ftell(pFile);
rewind(pFile);
// allocate memory to contain the whole file:
szFile = (char*)calloc(lFileSize, sizeof(char));
if ( szFile == NULL ) {
fclose(pFile);
return ( -1 );
}
char *szFileLine_1 = szFile;
if( fgets(szFileLine_1, lFileSize , pFile) == NULL ){
return -1;
}