uhm, how can i read a certain token (like you say, i need to read the 2nd and 4th token).
Ive managed to read all tokens now so now its like this:
so how can i read only the 2nd for example? It now reads all of them and writes to the file. but i only need 2nd and 4th.Code:#include <afx.h> using namespace std; int main() { CStdioFile fisierRead, fisierWrite; TCHAR buf[100], *token; fisierRead.Open(_T("C:\\text.txt"), CFile::modeRead|CFile::typeText); fisierWrite.Open(_T("C:\\text2.txt"), CFile::modeWrite|CFile::modeCreate); while(fisierRead.ReadString(buf, 99)) { token= wcstok(buf, _T(" ,")); fisierWrite.WriteString(token); while(token !=NULL) { fisierWrite.WriteString(token); token = wcstok(NULL, _T(" ,")); } } return 0; }




Reply With Quote