TNT Basic Forums > Programming Q&A
Text Files
< Last Thread     Next Thread >
Thread        Post A Reply

08-25-2002 23:13

Posted by:
Tony Rose

Click Here to Email Tony Rose   Find more posts by Tony Rose

I asked this awhile back and was told no..but now Im gonna ask again because the new update. Can TNT basic write/read straight from Text files? I wanna create a program for making Quake 3 config files but am not sure if TNT can do it. It would also be incredibly usefull for storing data in other game types. Let me know if TNT can do this please so I can get started programming! Thx.

08-26-2002 09:42

Posted by:

Find more posts by Socrates

Well yes but...

I believe TNT can indeed write to text files in the latest build (it's there in the documentation anyway), but for God's sake write this program in REALbasic instead. TNT is for making games, not editors, it would not be good for this purpose.

08-26-2002 14:08

Posted by:

Find more posts by ??

Socrates, not everybody can afford REALBasic and they might only have TNTBasic.

And yes, I believe you could do that.

08-26-2002 16:04

Posted by:
Tony Rose

Click Here to Email Tony Rose   Find more posts by Tony Rose


I indeed thought it might be easier to do in RealBasic but I am interested in game work with TNT(I had attempted some stuff earlier in its development,but 1.1 adds so many features I wanna learn) and writing this program will help me get a feel for how it works. I also like supporting the TNT community :)

08-27-2002 23:10

Posted by:
Mark Tully

Find more posts by Mark Tully

Text files

Hi Tony,

With TNT Basic 1.1 you can now access text files properly.


int myfileID = open file ("Config.ini", false, "TEXT", "TEXT")

Param 1 is the file name, in the current working directory (see the 'set directory' command).
Param 2 is whether you want to write to this file -- in this case false.
Param 3 is the Mac OS file type of the command, it's a text file edited by text editors
Param 4 is the file format that TNT Basic should read and write to the file with - again it is "Text" format.

Read the file with commands like:
str mystr = file read str (myfileId)
str myint = file read int (myfileId)

That reads a string/int up the end end of the line.

Once read, you can break a string up into other parts using commands like 'Get Char' if you wish.

Hope this helps!


All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.