[En-Nut-Discussion] pointer don't work?

Stefan Hax stefan at escherlogic.com
Thu May 12 15:39:26 CEST 2011


fread() returns a char count but the buffer handed to fread does not get 
null terminated ... you have to look at cnt.

Stefan.

Landsperger, Werner wrote:
> Hey together,
> I'm really become to desperate....
>  
> char *buff;
> buff = malloc(128);
> char *pointer;
>  
> cnt = fread(buff, 1, 128, istream);    // read in a buffer -> cnt = 128
> pointer = &buff;                               // should set a pointer
> to buff
> cnt = strlen(pointer);                        // should be 128 but ->
> cnt = 22 ????
>  
> I've also tried *pointer and so on but with no result! where is my error
> in reasoning? 
> Normaly pointer are no problem but I can't see the problem!!
>  
> Thanks a lot!!
>  
> Greets Werner
>  
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
> 



More information about the En-Nut-Discussion mailing list