Hello all
I have 2 txt files: text.txt, and text2.txt.
Text.txt contains this:
and text2.txt is an empty file.Code:ddddsd, 1111, sdsdss, 22222 ddddsd, 1111, sdsdss, 22222 ddddsd, 1111, sdsdss, 22222
What I want is to read only the numbers from the first file and write them into the second file. How can i achieve this? What Ive written so far works, except that it takes all the contents of the first file and places it into the 2nd (i only need the numbers though).
so how can i only read the numbers?Code:#include <afx.h> using namespace std; int main() { CStdioFile fisierRead, fisierWrite; CString s; fisierRead.Open(_T("C:\\text.txt"), CFile::modeRead|CFile::typeText); fisierWrite.Open(_T("C:\\text2.txt"), CFile::modeWrite|CFile::modeCreate); while(fisierRead.ReadString(s)) { fisierWrite.WriteString(s+ L"\n"); } return 0; }
thank u
PS - i dont need code only a hint![]()




Reply With Quote