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 / reading a txt file

Author
Message
TeePee
23
Years of Service
User Offline
Joined: 18th Apr 2003
Location: Australia
Posted: 27th Jul 2003 05:25
gday
well...ive got dbpro with the latest patch and ive been using it for a while so i do know how to code...im not really a newcomer but i am to this kind of coding tho: i want to know how to read from a .txt file using commands like open to read...read string etc..all those commands. if you could just post a snippet that has the following format..



cheers
Mattman
23
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 27th Jul 2003 06:06
umm, i think you want to do this...



---Mattman
DID YOU KNOW THAT ???
Mattman
23
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 27th Jul 2003 06:06
Edited:



---Mattman
DID YOU KNOW THAT ???
TeePee
23
Years of Service
User Offline
Joined: 18th Apr 2003
Location: Australia
Posted: 27th Jul 2003 06:22
cool so if my txt file was something like.....


george
bob
sam
matt
tim
alex
nick
tom
anthony
sandy

then the code would print it all out like that right?

ReD_eYe
23
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 27th Jul 2003 11:10
indeed,

You know whats weird???
Donald duck never wore pants, yet everything time he got out of the shower he put a towel around his waist...
Whats with that???
TeePee
23
Years of Service
User Offline
Joined: 18th Apr 2003
Location: Australia
Posted: 28th Jul 2003 02:37
ok well i tried all that and i fixed up the code to make it



and then i made a text file exactly like what i had in my previous post and i didnt work!!

it printed out the numbers from 1 - 10 in a column instead of the names!!

TeePee
23
Years of Service
User Offline
Joined: 18th Apr 2003
Location: Australia
Posted: 28th Jul 2003 02:50
ok well i tried this...



and it works except that it only reads the first word which is george but it does print it properly...so how would i read all the other words??

TeePee
23
Years of Service
User Offline
Joined: 18th Apr 2003
Location: Australia
Posted: 28th Jul 2003 02:53
wow i worked out something else......

if i did this...


it would print out the first 2 names: george and bob.

so it seems that everytime i do read string it goes to the next line. but then my next question is how would i go about going back to the first line or something?? that is, without closing the file and then opening it again??

Arkheii
23
Years of Service
User Offline
Joined: 15th Jun 2003
Location: QC, Philippines
Posted: 28th Jul 2003 03:55
Here.



Check the source box below if there is a problem

btw the reason why it prints 1-10 is because you used the str$() function. That makes a string out of any number or string you have in the parenthesis. The point is, go dload darkedit and you can easily tell which are keywords and which are not.

TeePee
23
Years of Service
User Offline
Joined: 18th Apr 2003
Location: Australia
Posted: 28th Jul 2003 04:10
rightyo

cheers

Login to post a reply

Server time is: 2026-07-06 04:29:01
Your offset time is: 2026-07-06 04:29:01