读取.html文件并替换为C
typedef struct {
wchar_t ID[11];
wchar_t Name[31];
wchar_t Faculty[51];
wchar_t Year[11];
wchar_t Email[21];
wchar_t Birth[11];
wchar_t LinkImg[15];} Student; Student ST[50]; // all 50 student
文件CSV
/*Including the 50 students*/
1512638 , Tony Nguyen , information technology , 2015 , 14/03/1990 , abcd@gmail.com , 1512638.jpg
代码
void ReadStudent() { wchar_t buffer[256];
wchar_t *pointer;
FILE *import;
import = _wfopen(L"Template/student.csv", L"r");
_setmode(_fileno(import), _O_U8TEXT);
if(import == NULL)
{
printf("Error");
}
while((pointer = fgetws(buffer, sizeof(buffer), import)) != NULL )
{
wcscpy(ST[i].ID, wcstok(pointer, L","));
wcscpy(ST[i].Name, wcstok(NULL, L","));
wcscpy(ST[i].Birth, wcstok(NULL, L","));
wcscpy(ST[i].Faculty, wcstok(NULL, L","));
wcscpy(ST[i].Email, wcstok(NULL, L","));
wcscpy(ST[i].Birth, wcstok(NULL, L","));
++i;
}
}
我现在该怎么办?替换?
void ReadWriteHTML(){ ??? Read template.html file
??? Replace $ID = ST[i].ID, $Name = ST[i].Name
??? Write ID.html ... all 50 ID student
}
链接sourcode:http://ideone.com/Ssv7GA