Why doesn't writing RGB data to a file with writeulong work?

Previous topic - Next topic

FutureCow

I have gotten this to work by using READ/WRITESHORTIEEE, but I'd be interested to know why this doesn't work (as I thought the typecast would be done automatically)

This was my original code that fails (but I thought would work as it would typecast)
Code (glbasic) Select
...
PixelColour=GETPIXEL(XLoop,YLoop)
WRITEULONG FileHandle, PixelColour
...
READULONG FileHandle, PixelColour
...


It fails on the "READULONG" line. Error :-
QuoteC:\DOCUME~1\Shane\LOCALS~1\Temp\glbasic\gpc_temp1.cpp: In function `DGInt __GLBASIC__::Designer_LoadSet()':
C:\DOCUME~1\Shane\LOCALS~1\Temp\glbasic\gpc_temp1.cpp:539: error: invalid initialization of reference of type 'DGNat&' from expression of type 'DGInt'
C:/Program Files/GLBasic/Compiler/platform/Include/glb.h:907: error: in passing argument 2 of `void __GLBASIC__::READULONG(DGNat, DGNat&)'

Using READSHORTIEEE and WRITESHORTIEEE works though.

Why isn't the DGInt (ie. ulong) converting to a DGNat? (Sorry, my C++ is VERY rusty!  =D )

MrTAToad

PixelColour is not an integer, and WRITEULONG/READULONG need one.

Kitty Hello

DGInt = "Dings Gamebasic Internal" (YUCK!!!) = floating point.
DGNat = natural = integer.

But I'll extend these functions to be able to use both. It's a true pain.

FutureCow