Mail Archives: djgpp/2000/04/29/06:43:00
In article <957001855 DOT 943830 AT romulus DOT infonie DOT fr>,
HPMAN <mwa DOT p AT infonie DOT fr> wrote:
>Isn't the '&' supposed to be implicit with arrays ?
>
>Always used an '&' with arrays and worked fine...
This misunderstanding suggests you might want to read more about C than
about DJGPP:
If char arrayname[80] is an array of 80 char,
. arrayname is (equivalent to) a pointer to the first char
. &arrayname is a pointer to a pointer to the first char
So in your example:
>fwrite(TestBuff,sizeof(char),32,output);
is correct, as TestBuff is pointer-to-char, but:
>fwrite(&TestBuff,sizeof(char),32,output);
is wrong, because &TestBuff is a pointer-to-pointer-to-char.
This is fundamental C programming. Have a look at Kernighan & Ritchie, or
possibly the C FAQ.
J-P
--
innowacyjną architekturą firmy NetManage związanąz
- Raw text -