dev_tyagi Posted July 2, 2005 Posted July 2, 2005 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();}
egrath Posted July 2, 2005 Posted July 2, 2005 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
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now