#define stop(a){clrscr();printf(a);ngetchx();} void* cree_un_nouveau_fichier(char* nom,short taille) { void* vptr; HANDLE h=HeapAlloc(taille+2); HSym hsym = SymAdd (SYMSTR(nom)); SYM_ENTRY *ptr = (DerefSym (hsym)); stop("avant la def du handle"); ptr->handle=h;// c'est ici que ca bug! stop("apré"); vptr=HeapDeref(ptr->handle); *(unsigned short *)vptr =(unsigned short)taille; return (vptr+2); }
qqun peut m'expliquer le probleme, merci beaucoup
sinon g aussi essayé ca mais sans succes
void* vptr; HSym hsym = SymAdd (SYMSTR(nom)); SYM_ENTRY *ptr = (DerefSym (hsym)); ptr->handle=HeapAlloc(taille+2); // ca non plus ca marche pas vptr=HeapDeref(ptr->handle); *(unsigned short *)vptr =(unsigned short)taille; return (vptr+2);
et juste au cas où, je situe où je l'utilise cette fonction ki marche pas:
je l'utilise en faisant ceci: je tire d'une matrice principale qq données que je mets ds une matrice secondaire en utilisant un fopen puis je cree ma seconde matrice avec cette fnc puis je fé un fread de la 1ere vers la 2nd matrice (fread(vptr,,,f))