How to declare variable containing character limiting to 1000 bytes in vb6

后端 未结 3 982
余生分开走
余生分开走 2021-01-25 07:11

How to declare variable containing character limiting to 1000 bytes in vb6

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-25 08:10

    Here is the syntax for a fixed-length string of 500 characters, which is 1000 bytes. VB6 strings are Unicode (UTF-16) and therefore each character has two bytes. The value of a fixed-length string will always have 500 characters - trailing spaces will be added, or excess characters truncated.

    Dim s As String * 500  ' 500 characters, 1000 bytes
    

    I wonder whether you are dealing with binary data rather than text. The Byte data type is better for binary data.

    Dim byt(1000) as Byte  ' an array of 1000 bytes
    

提交回复
热议问题