Page 6 of 11
Posted: Sun Jun 07, 2009 5:15 pm
by blueznl
Spot on.
A fixed length string is a preallocated block of memory, where you store strings or other data. As such, that part of memory can contain a null. However, all other (string) commands consider the null to be the end of the string.
Also, I do not know if fixed length strings are moved around in memory when PureBasic does some garbage recollection. Perhaps one of the PBdevs could tell us?
Fixed length strings are best used in, for example, structures. Regular strings that are part of a structure are NOT stored 'inside' the memory block where the structure resides, instead that memory block would contain a pointer to the real string. If you want to dump a number of those structs directly from memory to disk, you'd lose the actual string data.
Some DLL's use structures with fixed fields to communicate, for example the CAPI library. There are also some industrial protocols where a certain amount of text occupies a fixed part of the message.
In those cases fixed length strings are of great help.
Posted: Sun Jun 07, 2009 5:25 pm
by blueznl
PB wrote:
The guide needs to explain it more clearly, then.

It confused me.
That guide has been around for a couple of years now, guess this is the first time you're reading it?

Posted: Sun Jun 07, 2009 5:26 pm
by PB
Yes, it is. Well, reading it properly rather than just skimming through.

Posted: Tue Aug 18, 2009 9:04 am
by blueznl
Update.
Many small changes and corrections in parts I II III IV and V, whilst I'm looking forward to 4.40 final
(I know IV and further on need to be checked against the later versions as there is still some 3.9x in there, but I'm going to wait for 4.40 final to avoid duplicate work.)
Note that pages marked as 'under construction' still *may*

contain usable information
As usual:
http://www.xs4all.nl/~bluez/datatalk/purebasic.htm
Posted: Wed Aug 19, 2009 11:37 pm
by blueznl
Update.
Started to add some stuff on unsigned variable types for 4.40b1. If you're confused by signed versus unsigned go and have a look. Comments appreciated.
Posted: Thu Aug 20, 2009 11:04 am
by djes
Thanks for the updates!
I noticed a little error in
http://www.xs4all.nl/~bluez/datatalk/pu ... _variables :
For example, the PureBasic type 'byte' can hold values ranging from -127 to +127, whilst in most other
Byte can hold values ranging from -128 to +127... This error is repeated several times, and for other types (-32768 +32767 ...).
Keep on the good work!
Posted: Thu Aug 20, 2009 5:09 pm
by blueznl
Okay, will change it. Thanks. I'll add it to the next update.
Posted: Sat Aug 22, 2009 12:22 pm
by blueznl
Update.
Added Threaded and maps / hash tables / subsystems and some other small changes.
Posted: Mon Aug 24, 2009 1:17 pm
by GeBonet
I'm really glad that this guide exists. The perfect complement to the official manual. I regret that there have not the same in French.
I know that Comtois is very involved with the official manual in French and does a very good work too.
But this is not the same thing, we talk about something and more complete example. Unfortunately I do not know enough English to translate. And with the translator is too complicated. Which is just good to understand what this mean's it.
Very good work and always (almost) update.
Thank you very much

Re: PureBasic Survival Guide - update
Posted: Thu Sep 10, 2009 12:22 am
by blueznl
Update.
Some updates left and right, plus blob's, databases, MySQL, and a bit more on VirtualBox.
As usual:
http://www.xs4all.nl/~bluez/datatalk/purebasic.htm
Re: PureBasic Survival Guide - update
Posted: Thu Sep 10, 2009 7:44 pm
by blueznl
Update.
Sections on MySQL and VirtualBox are now complete.
Re: PureBasic Survival Guide - update
Posted: Sat Sep 12, 2009 12:47 pm
by blueznl
Update.
Some examples, updated downloadable version, some errors corrected, started working on the networking section.
Re: PureBasic Survival Guide - update
Posted: Sat Sep 12, 2009 1:02 pm
by GeBonet
Hello,
For the "map" that resume of sample may be can help the sample for the survival ? or some one ?
Code: Select all
; ==================================================================
; Autre Exemple / Other sample :
; ==================================================================
NewMap Test.s() ; Table indexé selon le Hascode Sur la Clef .....
Dim T$(5) ; Table qui contientdrait les clefs.... indépendament de Test.s()
;
; Ordre de création ....
T$(1)="Fred" :Test(T$(1)) = "1 -Toute une phrase qui contient tout les élément désiré "
T$(2)="Timo" :Test(T$(2)) = "2- deux ou 2"
T$(3)="Albert" :Test(T$(3)) = "3- Et ceci c'est le complément"
T$(4)="Joseph" :Test(T$(4)) = "4- c'est une série B"
T$(5)="Dorothe":Test(T$(5)) = "5- It's not a joke but not serious"
;--------------------------------------------------------
Debug " == Organisation de la table selon le Hash coding de Map ==="
ResetMap(Test()) ; Move to the begin of the Map - Deplace le pointeur en tête de la "map"
While NextMapElement(Test())
Debug Str(l+1)+" - "+Test() ; Here is the order of the map.... Ici l'ordre dans la table
l+1
Wend
l=0
Debug "====================================================="
Debug " Ordre selon l'appel par les clefs... donc de l'enregistrement correspondant"
Debug "-----------------------------------------------------------------------------------------------"
;--------------------------------------------------------------------------------------------------------------------
; Ordre d'extraction par appel en utilisant la clef / Calling Forme
;--------------------------------------------------------------------------------------------------------------------
; 1 on appelle la première clef du de T$(1)
FindMapElement(Test.s(), "Fred")
Debug "Fred="+Test.s()
; 2 on appelle la quatrième clef de T$(4)
FindMapElement(Test.s(), "Joseph")
Debug "Joseph"+"="+Test.s()
; 3 on appelle la cinquième clef de T$(5)
FindMapElement(Test.s(), "Dorothe")
Debug "Dorothe"+"="+Test.s()
; 4 on appelle la cinquième clef de T$(2)
B$="Timo"
FindMapElement(Test.s(), B$)
Debug B$+"="+Test.s()
; 5 on appelle la cinquième clef de T$(3) ="Albert"
;
FindMapElement(Test.s(), T$(3))
Debug B$+"="+Test.s()
; ----------------------------------------------------------------------------------------------
Debug "===== Numero element ======="
Debug "Donné par MapSize()="+Str(MapSize(Test()))
Debug "========================="
; ----------------------------------------------------------------------------------------------
ResetMap(Test()) ; Move to the begin of the Map - Deplace le pointeur en tête de la "map"
While NextMapElement(Test())
Debug Str(l+1)+" - "+Test() ; Here is the order of the map.... Ici l'ordre dans la table
l+1
Wend
Debug "======================="
Debug " classement par ordre des clefs"
Debug "-------------------------------------------------"
; OR
ResetMap(Test()) ; Move to the begin of the Map - Deplace le pointeur en tête de la "map"
For i=1 To 5
Debug Str(i)+" - "+Test(T$(i)) ; Here is we find with the key.... geved from the array T$(i)... recupère par la clef...
Next i
Debug "--------------- Autre forme d'utilisation de Map -----------------"
;
FindMapElement(Test.s(),InputRequester("Recherche","Donnez la clef d'accès : ", Clef$))
MessageRequester("Votre réponse est : ",Test.s(),#PB_MessageRequester_Ok )
;
Debug Test.s()
Debug "---------------- FIN -------------------------"
;
ClearMap(Test.s())
And me be you now wat is the using of "Flag" in the "; AddMapElement(Map(), Key$ [, Flags])"
and wat we can do with im... ?

Re: PureBasic Survival Guide - update
Posted: Thu Sep 17, 2009 8:25 am
by blueznl
Update.
Added PostgreSQL.
Re: PureBasic Survival Guide - update
Posted: Thu Oct 01, 2009 7:43 pm
by blueznl
Update.
Some minor fixes, and I created a batch file to make my life easier when it comes to keeping the downloadable version up to date.
The guide is here:
http://www.xs4all.nl/~bluez/datatalk/purebasic.htm
The downloadable version you will find here:
http://www.xs4all.nl/~bluez/datatalk/survival_guide.arj