Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / READ/WRITE command

Author
Message
Twinsen
18
Years of Service
User Offline
Joined: 20th Jun 2006
Location: Romania
Posted: 12th Mar 2008 07:39
hello! I have 2 questions regarding the read and write possibilities ( just from a file )

1) when using READ STRING, let's say I have a file with 3 lines ... how can I read each line in a string ???
2) when using WRITE BYTE, I say for example ( write byte 1, 128 ) but the thing is that it writes a weird character ... so how am I supposed to know the character equivalent of a byte ??? Is there a byte to character conversion tool ??? cause I want to be able to write for example "A" using the WRITE BYTE command, not WRITE STRING ... thanks

Could you help me treat my injured Dino-Fly ?
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 12th Mar 2008 09:39
1. Use a string array.

2. All ASCII characters are 1 byte long. Use ASC() to get the ASCII code of the character. Chr$() is the reverse - giving you the character from the ASCII code.

TDK_Man

Twinsen
18
Years of Service
User Offline
Joined: 20th Jun 2006
Location: Romania
Posted: 13th Mar 2008 16:59
what about this: let's say I have a file with 5 lines and I want each line to be read inside a separate string ... how would I do that ???

Could you help me treat my injured Dino-Fly ?
Twinsen
18
Years of Service
User Offline
Joined: 20th Jun 2006
Location: Romania
Posted: 13th Mar 2008 21:45
aha thanks a lot that's what I did but I thought it was a wrong method

Could you help me treat my injured Dino-Fly ?
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 13th Mar 2008 23:29
Why would you even do that? What if later on you need to update the program to read 10 lines?



This does put each line into a separate variable, but the number of lines can be changed by changing a single number and each variable, being an array is infinitely more flexible than:



TDK_Man

Twinsen
18
Years of Service
User Offline
Joined: 20th Jun 2006
Location: Romania
Posted: 13th Mar 2008 23:33
wopeee now I finally got arrays in DBPRO thanks a million TDK !!!

Could you help me treat my injured Dino-Fly ?
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 14th Mar 2008 06:05

Login to post a reply

Server time is: 2024-11-25 05:20:09
Your offset time is: 2024-11-25 05:20:09