Page 1 sur 1

[RESOLU] newlist et pointeurs

Publié : jeu. 03/juil./2014 15:44
par supercdfr
Bonjour,

j'ai 2 besoins obligatoires : utiliser une liste, et un pointeur dans cette liste.
voici mon programme qui ne marche pas :

Code : Tout sélectionner

Structure restaurant
  *buffer_x
EndStructure
Global NewList info_restaurant.restaurant()

Procedure test()
  AddElement( info_restaurant() )
  *buffer = AllocateMemory(1024)
  PokeS(*buffer , "123456789915484" , 1024)
  info_restaurant()\buffer_x = AllocateMemory(1024)
  CopyMemory(*buffer , @info_restaurant()\buffer_x , 1024) ;-> ERREUR
EndProcedure

test()
ForEach  info_restaurant() 
  Debug PeekS(@info_restaurant()\buffer_x , 1024)
Next
je ne trouve pas d'aide dans la doc ou les forums.
Et j'ai bien sur besoin de ce pointeur et de de faire le copymemory.

Petite precision : *buffer ne contient pas forcement que des lettres, mais tout des datas.

RESOLU en cherchant un peu.
Il faut virer les @ devant @info_restaurant()\buffer_x

Re: HELP : newlist et pointeurs

Publié : jeu. 03/juil./2014 16:12
par djes
Tiens, il est amusant ton code ! Ici (x86), sur la version 5.21, il plante en unicode, et sur la version 5.3b5, il plante sans unicode !
M'enfin, le voici vite fait modifié, qui ne bugge plus

Code : Tout sélectionner

Structure restaurant
  *buffer_x
EndStructure
Global NewList info_restaurant.restaurant()

Procedure test()
  AddElement( info_restaurant() )
  *buffer = AllocateMemory(1024)
  PokeS(*buffer , "123456789915484" , 1024)
  info_restaurant()\buffer_x = AllocateMemory(1024)
  CopyMemory(*buffer , info_restaurant()\buffer_x , 1024) ;-> ERREUR
EndProcedure

test()
ForEach  info_restaurant() 
  Debug PeekS(info_restaurant()\buffer_x , 1024)
Next

Re: HELP : newlist et pointeurs

Publié : jeu. 03/juil./2014 16:13
par G-Rom

Code : Tout sélectionner

Structure restaurant
  *buffer_x
EndStructure
Global NewList info_restaurant.restaurant()

Procedure test()
  AddElement( info_restaurant() )
  string.s = "123456789915484"
  *buffer = AllocateMemory( Len(string) )
  PokeS(*buffer , string , Len(string))
  info_restaurant()\buffer_x = AllocateMemory(Len(string))
  CopyMemory(*buffer , @info_restaurant()\buffer_x , Len(string)) ;-> ERREUR
EndProcedure

test()
ForEach  info_restaurant() 
  Debug PeekS(@info_restaurant()\buffer_x)
Next