View Full Version : Random Access Files & .NetCF
Noble Bell
07-21-2004, 01:23 PM
Does anyone know if the .Net Compact Framework (ie. Pocket PC) supports random access files? I know that you could use random access files with eVb but I am having trouble finding out if you can use them with Vb.Net. I know that I can use them on the full framework (ie. Desktop) but I am asking about the ppc or compact framework.
Thanks in advance,
Noble
MKoslof
07-21-2004, 08:56 PM
Unfortunately I don't think the compact framework supports random access files :). You might want to look into using XML instead..if that is not a viable option for you, If you really need a random access file type functionality, you can use the BinaryReader and BinaryWriter classes in System.IO.
Then, instead of writing out entire records at once, you have to write out records one field at a time. Also, when you write out string variables, make sure you pad
them to the same length (use spaces). This way, all of your records will still be the same length. And the string fields will be 1 greater in length, because of the null terminating character..but it can be done with some grunt work :)
Noble Bell
07-22-2004, 08:50 AM
Thanks for your reply.
I suppose the ability to jump straight to a record in the binary file is not an option like it would be in a true random access file. Correct?
Thanks,
Noble
MKoslof
07-22-2004, 09:31 AM
You would be correct, sorry :)
Powered by: vBulletin v3.8.4