■ Ce code me donne le bon résultat.
Code : Tout sélectionner
string.s = "Hello !"
Debug StringByteLength(string)
*memory = AllocateMemory( StringByteLength(string))
CopyMemory(@string, *memory, StringByteLength(string))
Debug MemorySize(*memory)
Debug PeekS(*memory)
■ Par contre celui là en ajoutant un caractere au string a un résultat étrange.7
7
Hello !
Code : Tout sélectionner
string.s = "Hello !!"
Debug StringByteLength(string)
*memory = AllocateMemory( StringByteLength(string))
CopyMemory(@string, *memory, StringByteLength(string))
Debug MemorySize(*memory)
Debug PeekS(*memory)
■ Que dit l'aide ?8
8
Hello !!¬;\Bµ¢
Le nombre d'octets renvoyé n'inclu PAS le caractère 'nul' de fin de chaîne. La taille du caractère nul est de 1 octet en mode ASCII
Est ce que cela veut dire qu'il faut faire un AllocateMemory() en ajoutant 1 systématiquement (ou +2 en unicode)?
Code : Tout sélectionner
*memory = AllocateMemory( StringByteLength(string) + 1)
Merci.