English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. Blitz Basic

 
 
Thread Tools
Old 19 September 2019, 23:24   #1
peceha
Registered User

peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 43
Posts: 208
[blitz] how to set initial variables read from a file

Hi,
let's say I have an ini.txt:
Code:
var_a=13
var_b=176
str$="olaboga"
Now the program part:

Code:
read a line
split by (=) 
while first part <> "var_a"
.read next line
.split by (=)
.if EOF then goto getout
wend
var_a=second part
getout:
and repeat the same for remaining variables.
I think there must be faster way of doing this.
Thanks
peceha is offline  
Old 20 September 2019, 00:20   #2
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 3,929
You could use a macro for that.

Or, if you can keep all your variables in a newtype, use ReadMem File#, &myType, SizeOf(myType)
idrougge is offline  
Old 20 September 2019, 10:31   #3
peceha
Registered User

peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 43
Posts: 208
When you said "macro" my 1st thought was to go like that:
Code:
Macro blabla
  `1=`2
End Macro
then, after Split(=), when I have part_a$ and part_b$ do something like:

Code:
!blabla{ part_a$ , part_b$ }
but that won't work
and I'm sure it is what you meant
peceha is offline  
Old 20 September 2019, 12:56   #4
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 3,929
I see what you mean. What you're looking for is reflection, and Blitz (like many other static languages) has no reflection.
idrougge is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can an A4000 hard disk be set to read only? Starglider 2 Amiga scene 19 17 August 2019 02:18
File Access From Within Blitz Basic 2 LuMan Coders. Blitz Basic 4 24 November 2015 09:23
overscan and mouse settings option to be read from external file _psy project.WHDLoad 5 15 April 2015 14:30
The lesser-known Initial Chip Set (ICS) mystery andreas support.Hardware 26 17 July 2013 03:39
File input with Blitz MelOtt Coders. General 0 05 January 2005 18:48

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 00:00.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Page generated in 0.07128 seconds with 15 queries