July 2, 200521 yr Hi to all i m having problem in reading a unicode string from a unicode formatted file can any one direct me how to read a string till a given delimenator the code i m writing is char buffer =new char[2500];memset(buffer,'\0',strlen(buffer));fstream fp,fp1;fp.open("c:\\filedata1.txt",ios::in);if (!fp.is_open()) { cout << "couldn't open file" << endl; exit(3); }else while(!fp.eof()) { fp.getline(buffer,2500,'¶'); fp1.open("c:\\notfounddata2.txt",ios::out); fp1.write(buffer,2500); cout<<buffer; memset(buffer,'\0',strlen(buffer)); }fp.close();fp1.close();}
July 2, 200521 yr Hi,use the strstr function which gives you back the position of the first occurence of the wanted char's. Than read from the beginning of the string till this position.when i need to read from a file till the occurence of a specific pattern i use a self written function which reads byte by byte and checks if i read the pattern i am looked for. post me a pm if you need those code.Egon
Create an account or sign in to comment