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.

DarkBASIC Professional Discussion / Reading from a .txt file

Author
Message
FieldDoc
23
Years of Service
User Offline
Joined: 30th May 2003
Location: London, UK
Posted: 18th Jun 2003 00:21
If I write a paragraph in Notepad and save it as a .txt file, how could I print to the screen what is in that file in my game using DBPro?
Life is like a penis:
When it's soft you can't beat it, when it's hard you get screwed.
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 18th Jun 2003 00:24
It depends :

A) If you saved as an INI file, you can use my plug-in to read a line
B) Alternatively, you can open the file, read a byte or a string at a time, and then print

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
FieldDoc
23
Years of Service
User Offline
Joined: 30th May 2003
Location: London, UK
Posted: 18th Jun 2003 00:26
What's an INI file and would it be easier to use that?

How do I know how many strings are in the file? I take it you have to press enter after each line?

Life is like a penis:
When it's soft you can't beat it, when it's hard you get screwed.
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 18th Jun 2003 00:36
An INI file just holds initialisation data in the format of :

[header]
var=something
...
INI files (despite Microsofts attempts to get rid of them) are very useful, and to be honest, should be used instead of the registry commands.

I would think you would need to press return (or have some other end-of-line marker) to make sure that each string is read on its own
Once (possible) an empty string is returned, you've hit the end of the file.

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
ICERGB
23
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 21st Jun 2003 12:21 Edited at: 21st Jun 2003 12:27
dim snoggle$(100)
load array "bisquik.txt",snoggle$(0)
repeat
inc a
print snoggle$(a)
until snoggle$(a+1)=""

wait key

MrTaToad is very excellent in memory data and could kick my butt in programming any day...
I think maybe he is just to caught up in data right now or somethin.

Could be C++ or visual-basic burnout...
ha!
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 21st Jun 2003 20:18
Hope not...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!

Login to post a reply

Server time is: 2026-07-11 14:55:04
Your offset time is: 2026-07-11 14:55:04