Read a .txt file in Symbian


If you want to read a file and display that on alert screen the following code snippet will do that for you.

TBuf8<128> rcvr;
TBuf<128> tDsply;
RFs fSessionRd;
User::LeaveIfError(fSessionRd.Connect());
RFile fileRd;
TInt retRd=fileRd.Open(fSessionRd, _L("C:\\testFile.txt"), EFileRead);

if(!retRd){
fileRd.Read(rcvr);
tDsply.Copy(rcvr);
iEikonEnv->AlertWin(tDsply);
}
Advertisements