Friday, November 25, 2011

Saving/Loading TStream on iOS device using FPC

I've programmed a small application for iOS using the XE2 and FMX capabilities.
Anyhow, when reaching the stage where I needed to save the data, I've encountered a problem of a foreign language with the FPC.



While using the XE2 strictly with the win32/64 environments there is no such problem of encoding cause of the unicode abilities of the development tool.

However, while porting that to the iOS there need to be a consideration of the FPC limits so far. I've been using the TWideStrings object which does the unicode properly. 

There is a sample code writing text to the iOS device on embarcaderos site -- but that didn't help me much due to the use of the foreign language that the application was attended to. When saving the data to the iOS device, I needed to write additional code that writes the data without any consideration of its language - in a binary style if one can.

The following code is to save/load TStream on an iOS device using the FPC, that I have written: