TAILIEUCHUNG - Symbian OS C++ for Mobile Phones VOL 1 PHẦN 6

Có một vấn đề, mà tôi sẽ trình diễn tại Chương 15, bởi vì tôi đã không whited khu vực nền giữa hội đồng quản trị và cạnh kiểm soát. Tôi có thể giải quyết một cách dễ dàng bằng cách sử dụng, nói, làm mất hiệu lực CFleetView:: Draw | Update view iAppView- DrawNow The normal sequence of processing here is that I invoke the dialog using the terse syntax that was covered in Chapter 10 write the file and redraw the app view to reflect the new iText value. If WriteFileL leaves I handle it by deleting iText and setting its pointer to 0. I also delete the file. Then I redraw the app view and use User Leave to propagate the error so that Uikon can display an error message corresponding to the error code. Test this if you like by inserting User Leave KErrDiskFull somewhere in WriteFileL . The trap handler has one virtue it lets the user know what s going on. It s still not good enough for serious application use though because this approach loses user and file data. It s a cardinal rule that Symbian OS shouldn t do that. A better approach would be to do the following Write the new data to a temporary file if this fails keep the user data in RAM but delete the temporary file. Delete the existing file this is very unlikely to fail but if it does keep the user data in RAM but delete the temporary file. Rename the temporary file this is very unlikely to fail and if it does we re in trouble. Keep the user data in RAM anyway. I would need to restructure my program to achieve this the application architecture s framework for load save and embeddable documents looks after these issues for you. For database-type documents you face these issues with each entry in the database. They are managed by the permanent file store class which we ll encounter below. Reading it Back The code to read the data we have written is similar. Firstly we read the filename from a dialog and then use OkToExitL to do some checking. This time the code is much easier and I ll present it in one segment TBool CExampleReadFileDialog OkToExitL TInt aKeycode Termination Get filename CEikFileNameEditor fnamed static cast CEikFileNameEditor Control EExampleControlIdFileName HBufC fileName fnamed- GetTextInHBufL Check it s even been .

TỪ KHÓA LIÊN QUAN
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.