![]() Your file is not a text file! It contain binary information as well as packed BCD. You can also use the StringBuilder class, which maybe is the right way to do it, but I have never tried it so I can't guide you with that. Therefore it is not a good idea to use a long row of "&" statements to build the string. ![]() This is a very time consuming procedure, which also leads to a serious fragmentation of the memory. ![]() Therefore, all string manipulations has to be done by making a new instance of the String class, copying the string(s) and then abandon the previous string. NET all strings are immutable, meaning you cannot change its length or contents once it is defined. You know, I am from the time where memory was expensive :-) At last I would convert the array to a string by means of a the "Dim ResultString As New String(ByteArray, 0, Length)" statement. ![]() I am not an expert in file handling, but I would probably just read each record into the last part of a byte array big enough to hold the converted result, so that I could use the same array for the result. Of course you can refine the system with leading zero suppression so that e.g. The next 10 bytes are just the article name in ASCII, which does not need to be converted (or may be converted with Chr(Byte)), and so on. After 3 bytes you insert a "." in the text stream and then the last byte converted to ASCII. The next 4 bytes is the price in packed, unsigned BCD with two digits, that is, #.#, so you can just take one byte at a time and convert the byte to two ASCII characters as I have shown before (HighDigit and LowDigit). Therefore, it is best to regard it as a binary file and not a text file. The first byte is just the article type, so a simple case statement may convert that to 4 different text strings. ![]() Sorry, but I still don't see where the problem is.Įach record consist of 29 bytes, which is a mix between binary, ASCII and BCD. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |