Mail Archives: djgpp/2000/04/29/06:13:24
Isn't the '&' supposed to be implicit with arrays ?
Always used an '&' with arrays and worked fine...
Thus, fwrite(TestBuff,sizeof(char),32,output); and
fwrite(&TestBuff,sizeof(char),32,output); aren't supposed to be the same ???
I agreed in case of a pointer, but with static arrays...
Why does it work in a program and not in another one ???
Could this be a specification to DJGPP ?
Anyway, I still have problem when writing a part of a buffer with :
fwrite(Clut,32,1,output);
Clut is declared as unsigned char *Clut;
and allocated with :
if((Clut=(unsigned char*)malloc(sizeof(unsigned char)*1048576))==NULL) {
printf("Woops, out of memory !!!\n");
exit(0);
}
allowing 1 Meg of memory (I don't use the full Meg, but since the buffer is
frequently accessed, I avoid many malloc and free, saving some speed...
And I get SIGABRT signal ....
This is in fact my main problem, since I found the other one trying to
resolve this one making some tests to see what's wrong...
Egon Eckert <egon AT chance DOT cz> a écrit dans le message :
20000429101940 DOT A22474 AT chance DOT cz...
> > fwrite(&TestBuff,sizeof(char),32,output);
>
> This is wrong. Try
>
> fwrite(TestBuff,sizeof(char),32,output);
>
> (without the '&').
>
> Egon Eckert
- Raw text -