Problem write data to file with RFileWriteStream ! Please help me ! Thanks!
| Thu, 2006-03-16 09:21 | |
|
Hi all !
I want to write data from file a.txt to b.txt by using "RFileWriteStream" and "RFileReadStream".But data doesn't write into b.txt file . Please help me to correct my code ! Thanks very much !. //============= This is my code ======== void CView01::WriteData() { //===== Connect to File server RFs aFs; User::LeaveIfError(aFs.Connect()); CleanupClosePushL(aFs); _LIT( Filepath02, "C:\\b.txt"); _LIT( Filepath01, "C:\\a.txt"); //===== Object for reading stream RFileReadStream fRead; //===== Open a read stream User::LeaveIfError(fRead.Open(aFs, Filepath01, EFileRead)); TInt8 pBuf1 = fRead.ReadInt8L(); TInt8 pBuf2 = fRead.ReadInt8L(); TInt8 pBuf3 = fRead.ReadInt8L(); //===== Write to File RFileWriteStream fWrite; //===== Open a write stream User::LeaveIfError(fWrite.Create( aFs, Filepath02, EFileWrite ) ); fWrite.WriteInt8L(pBuf1); fWrite.WriteInt8L(pBuf2); fWrite.WriteInt8L(pBuf3); CleanupStack::PopAndDestroy(&aFs); } //=========== doctinh113114=========== |
|






Forum posts: 176
Don't leave immeadiatly and look at the return code. If file couldn't get created try it with open. Only if open failed too, leave.
Additional: try to open with "EFileWrite | EFileShareAny" and what about a commit and close of the streamwriter?
Hope this will help, bye;
CG
Forum posts: 276
Check CommitL
http://www.symbian.com/developer/techlib/v70sdocs/doc_source/reference/cpp/FileStores/RFileWriteStreamClass.html
Today is a gift by GOD, that's why it is called the present.
Forum posts: 107