Text Fle Filter
-
Hi All How can i filter text file?I have a file Test.txt which have some data like this.
abc
abc
12121
12121
12
12
133
133
133Now i want to show data on Button click like this
abc
12121
12
133Plz help me...
One alternative is to put the read string into a map. Once you do this, go and read the next string from the file. If this string exists in the map ignore it and do not put it in the map and so on. While displaying, display only the elements present in the map. Hope it helps
You need to google first, if you have "It's urgent please" mentioned in your question. ;-)_AnShUmAn_
-
Hi All How can i filter text file?I have a file Test.txt which have some data like this.
abc
abc
12121
12121
12
12
133
133
133Now i want to show data on Button click like this
abc
12121
12
133Plz help me...
Read line by line into an STL
list
class and call theunique
method. Call thesort
method beforeunique
if the data is not already sorted.«_Superman_» I love work. It gives me something to do between weekends.
-
Read line by line into an STL
list
class and call theunique
method. Call thesort
method beforeunique
if the data is not already sorted.«_Superman_» I love work. It gives me something to do between weekends.
-
Read line by line into an STL
list
class and call theunique
method. Call thesort
method beforeunique
if the data is not already sorted.«_Superman_» I love work. It gives me something to do between weekends.
-
Hi All How can i filter text file?I have a file Test.txt which have some data like this.
abc
abc
12121
12121
12
12
133
133
133Now i want to show data on Button click like this
abc
12121
12
133Plz help me...
-
Hi All How can i filter text file?I have a file Test.txt which have some data like this.
abc
abc
12121
12121
12
12
133
133
133Now i want to show data on Button click like this
abc
12121
12
133Plz help me...
BOOL flag;
flag=FALSE;CStdioFile file; CString str,str2; str=str2=\_T(""); file.Open(\_T("G:\\\\Test.txt"),CFile::modeRead |CFile::typeText ,0); while(file.end) { file.ReadString(str); if(!str.Trim().IsEmpty()) { if(flag==FALSE) { CStdioFile file1; file1.Open(\_T("G:\\\\final.txt"),CFile::modeCreate|CFile::modeWrite|CFile::typeText ,0); file1.Seek(0,CFile::end); file1.WriteString(str); file1.WriteString(\_T("\\n")); file1.Close(); flag=TRUE; } if(file\_read\_write(str)==FALSE) { CStdioFile file2; file2.Open(\_T("G:\\\\final.txt"),CFile::modeWrite|CFile::typeText ,0); file2.Seek(0,CFile::end); file2.WriteString(str); file2.WriteString(\_T("\\n")); file2.Close(); } } else if(str.Trim().IsEmpty()) { break; } } file.Close(); ShellExecute(NULL,\_T("open"),\_T("G:\\\\final.txt"),NULL,NULL,SW\_SHOW); BOOL file\_read\_write(CString string);
BOOL Ctest::file_read_write(CString string)
{
BOOL flag=FALSE;
CStdioFile file;
CString str1;
str1=_T("");file.Open(\_T("G:\\\\final.txt"),CFile::modeRead |CFile::typeText ,0); while(file.end) { file.ReadString(str1); if(!str1.Trim().IsEmpty()) { if(\_tcscmp(string,str1)==0) { flag=TRUE; break; } } else { break; } } file.Close(); if(flag==TRUE) { return TRUE; } else { return FALSE; }
}
To accomplish great things, we must not only act, but also dream; not only plan, but also believe.