PB NO

Just starting out? Need help? Post your questions and find answers here.
Thalius
Enthusiast
Enthusiast
Posts: 711
Joined: Thu Jul 17, 2003 4:15 pm
Contact:

Post by Thalius »

hmm.. could even be a bot posting ...

Image

:lol:
"In 3D there is never enough Time to do Things right,
but there's always enough Time to make them *look* right."
"psssst! i steal signatures... don't tell anyone! ;)"
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post 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!
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
codefire
User
User
Posts: 38
Joined: Thu Mar 15, 2007 4:32 pm
Location: UK

Post 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
Clutch
User
User
Posts: 52
Joined: Sun Nov 26, 2006 6:11 am
Location: South Florida

Post 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.
"Ahead one third... ahead two thirds... Full ahead flank
And out from the belly of the whale came a prophet, Amen"
User avatar
GeoTrail
Addict
Addict
Posts: 2794
Joined: Fri Feb 13, 2004 12:45 am
Location: Bergen, Norway
Contact:

Post 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
I Stepped On A Cornflake!!! Now I'm A Cereal Killer!
Matt
Enthusiast
Enthusiast
Posts: 447
Joined: Sat May 21, 2005 1:08 am
Location: USA

Post by Matt »

PBChinese, I think this perfect solution, it worked for me. 8)
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

Post 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"
codefire
User
User
Posts: 38
Joined: Thu Mar 15, 2007 4:32 pm
Location: UK

Post 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
User avatar
GeoTrail
Addict
Addict
Posts: 2794
Joined: Fri Feb 13, 2004 12:45 am
Location: Bergen, Norway
Contact:

Post 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 :)
I Stepped On A Cornflake!!! Now I'm A Cereal Killer!
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post 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.
oh... and have a nice day.
Post Reply