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 / Weird error with Read and Data

Author
Message
Madscientist
16
Years of Service
User Offline
Joined: 23rd Aug 2009
Location: Between a rock and a hard place
Posted: 11th Oct 2010 14:29
I'm using data and read to read in data at coordinates into arrays. I got it to work but then suddenly it stopped working. I got this error message.
Failed to 'Calculate DataOffsetAndTypeFromFieldString::pFieldData->GetChar(n)=='.''
Whats wrong?


My computer surpasses all the technologies of the day. What computer do I have?

Silverman
19
Years of Service
User Offline
Joined: 18th Jan 2007
Location: France
Posted: 11th Oct 2010 15:16 Edited at: 11th Oct 2010 15:17
hi,

I tested your function with the code:




and I did not get an error.


@+

AMD Athlon(tm)XP 3200+ (2.2GHz) / DDR pc3200 (3x1024Mo) / Nvidia 6800GT (driver 197.45 WHQL)/ XP Pro SP3 / DirectX 9.0c (February 2010)/ DBClassic v1.2 / DBPro v7.4
sladeiw
17
Years of Service
User Offline
Joined: 16th May 2009
Location: UK
Posted: 11th Oct 2010 15:35 Edited at: 11th Oct 2010 22:20
Have you any other data statements in your program? You don't need to execute data statements to make them available. There is an internal pointer that points at the first data statement when your program start. Each time you `read` some data, the pointer moves to the next available data. So, something like this:



I too ran your code and as far as I can see, everything reads into the correct variable. But if you have other data statements then it may be reading values from there and causing your error.

Is that error actually generated when you read the data statements? Because even if I changed the data to the wrong expected type it still read them without an error. (Just resulting in zero or blank string)
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 11th Oct 2010 17:56
Having DATA in functions doesn't work. If you want to separate the sections (like you had in the functions) use labels for each section and use the RESTORE command the way Sladeiw has with startdata:. All RESTORE does is tells Darkbasic that you want to start reading DATA from that label.

Madscientist
16
Years of Service
User Offline
Joined: 23rd Aug 2009
Location: Between a rock and a hard place
Posted: 11th Oct 2010 20:02
There is no more Data statements in the program other than the ones I posted in the code. I get the error even without exectuting the read statements and the data statements so the problem might be elsewhere. Has anyone else gotten this error befor?

My computer surpasses all the technologies of the day. What computer do I have?

Login to post a reply

Server time is: 2026-07-22 03:52:02
Your offset time is: 2026-07-22 03:52:02