Hi All,
1. I want to read given number of bytes form file.
2. I wnat number of bytes actually read.
my code is
Code:TBuf8 <50> szDataRead; TBuf <MAX_PATH> szFilePath; _LIT(KFILE, "C:\\a.txt"); szFilePath.Copy(KFILE); // // Connect file session. // User::LeaveIfError(fsSession.Connect()); // // Constructs & pushes object onto cleanup stack. // CleanupClosePushL(fsSession); // // Open file. // iRetVal = rfile.Open(fsSession, szFilePath, EFileRead); if (KErrNone != iRetVal) { CleanupStack::PopAndDestroy(1); // fsSession return; } CleanupClosePushL(rfile); TInt iRead = 10; iRetVal = rfile.Read(szDataRead, iRead); if (KErrNone != iRetVal ) { CleanupStack::PopAndDestroy(2); // rFileScanchk, fsSession return; }
if file a.txt is empty, still Read returns KErrNone and iRead contains value 10. so is it neccessary to check file size before any file operation? Read call not take care for this?how to get number of bytes actually read from file?
Thanks & Regards,
sheetal.

Reply With Quote


