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.

Bug Reports / [DBP 6.6] File reading commands return 0 when used with different types

Author
Message
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 22nd Nov 2007 11:57 Edited at: 22nd Nov 2007 15:27
I'm not sure if this is intended behaviour, but when you read data from a file the variable type must match the type you're reading else the result is 0. Try this with a text file containing a few characters:



It's probably worth noting that the integer type works when reading any type.

Tempest (DBP/DBCe)
Multisync V1 (DBP/DBCe)
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 22nd Nov 2007 14:56
You need to post *all* of the code, including the code you use to write the data file.

Currently I can't reproduce your problem - it's all working fine for me:


Utility plugins collection and
http://www.matrix1.demon.co.uk for older plug-ins and example code
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 22nd Nov 2007 15:24 Edited at: 22nd Nov 2007 15:35
Quote: "You need to post *all* of the code"

Yes, I posted *all* my code and tried loading a text file containing 'aaaa'.

In your code I don't see you actually declaring any variables? The bug here is if you declare a variable of a certain type (other than integer), then try to read data of another type into it, it doesn't work. For instance if you declare a variable as 'dword' and use READ WORD on it. Unless this is supposed to happen? I'm under the impression that all unsigned types actually act the same and the naming is pointless. Maybe I'm getting confused with the fact that all variable types use 4 bytes or something? Or maybe I'm completely lost.

Either way, shouldn't it be possible to read a word into a dword variable? If not, where's the compiler error?

Tempest (DBP/DBCe)
Multisync V1 (DBP/DBCe)
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 22nd Nov 2007 20:01
Ok, now I can reproduce your problem and I see what you mean:


Quote: "I'm under the impression that all unsigned types actually act the same and the naming is pointless"

They have storage of 4 bytes internally I believe, but you can only access 2 bytes of it for a word, so it's not really pointless.

Utility plugins collection and
http://www.matrix1.demon.co.uk for older plug-ins and example code
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 22nd Nov 2007 20:23
Quote: "They have storage of 4 bytes internally I believe, but you can only access 2 bytes of it for a word, so it's not really pointless."

Ah OK, that makes sense.

Tempest (DBP/DBCe)
Multisync V1 (DBP/DBCe)

Login to post a reply

Server time is: 2024-05-07 06:41:11
Your offset time is: 2024-05-07 06:41:11