![]() |
|
|||||||
| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Questions & Help Needed Post any question regarding Basic4ppc. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi,
I need to read a dbase III file (*.dbf), change a few records and write it back. As I do not know a better way to do it, I'm trying to open it as a binary file, I tried reading help on binary files but couldn't get what I need to know. Question1: I managed to read one file, in binary mode, using ReadBytes, but got an error message when trying to assign what I read to a string using BytesToString (help file says BytesToString returns a string): length = bin.ReadBytes(buffer(),5) Version = bin.BytesToString(buffer(),1,3) What am I missing? Question2: I have a text file that has just two chars "AB". A is ASCII 65 (41HEX) and B is ASCII 66 (42HEX). I read the file in binary mode using in_data = bin.ReadInt16 and printed in_data in a MsgBox; got the decimal value 16961, which means (I think) that those bytes are dealt in reverse order "BA", otherwise I would get for "AB" = 41HEX 42HEX = 16706 decimal. Is that so, I mean, are bytes in binary numbers written in reverse order? |
|
|||
|
The file I'm reading is a text file with five chars "ABCDEF".
I believe I found what was happening. I assigned what I read to a variable named Version and I got the message: "Error compiling program. Error description: Illegal first word in line. Occured on line: 37 Version= bin.BytesToString(buffer(),1,3)" Version must be a reserved word because after changing variable's name to VVersion I got no more error messages. Thank you for your help. |
|
|||
|
Is it possible to have more than one Binary File open at the same time, for example, one for reading and the other for writing?
If so, how can you tell which file you are referring to when using instructions like: bin.Position bin.ReadBytes ... ![]() |
|
||||
|
You must define 2 binary file objects like and open the 2 files.
Code:
FileOpen(c1,file,cRandom) bin1.New1(c1,false) FileOpen(c2,file,cRandom) bin2.New1(c2,false) Best regards.
__________________
Klaus Switzerland |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Coverting text files with binary file page code functionality | kolbe | Code Samples & Tips | 1 | 06-21-2008 06:06 PM |
| Using Binary.dll... how to? | Rod | Questions & Help Needed | 9 | 12-17-2007 02:24 PM |
| Binary files on device | Ianmac | Questions & Help Needed | 4 | 08-24-2007 08:49 AM |
| Binary File problem | Ianmac | Questions & Help Needed | 3 | 08-07-2007 06:44 PM |
| Binary Files- Love'm and sometimes confused | XerVision | Questions & Help Needed | 2 | 06-10-2007 08:55 PM |