Click to See Complete Forum and Search --> : storing strings on disk
dichelson
May 6th, 2009, 09:30 AM
Hello everybody. Is it true that strings are stored in memory in UNICODE format but are converted to ANSI when you save them on disk? Thank you.
LaVolpe
May 6th, 2009, 09:35 AM
Generally speaking: Yes. If by unicode format, you mean 2 bytes per character. Strings can be written to disc in 2 byte format if desired. FYI: VB controls and unicode do not work well together.
Note: VB really stores strings in memory in what is called a BSTR format. There are plenty of articles describing BSTR and how VB stores/handles strings.
What is a BSTR? A bstr is a pointer to a string of wide characters (2 bytes per char). The string is not terminated. Instead, the length of the string is stored as an unsigned long (four bytes) just before the first character of the string.
Edited: Here is a great article on CodeGuru regarding VB datatype storage. (http://www.codeguru.com/vb/gen/vb_misc/algorithms/article.php/c7495) Took me a bit to locate it; haven't reviewed it in quite a few years.
Hack
May 6th, 2009, 11:34 AM
Moved To General Developer
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.