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

Landsperger, Werner Werner.Landsperger at cassidian.com
Thu May 12 16:11:26 CEST 2011


Hey Stefan,

sorry I don't understand you completely. This Codesniped is only a
sample and not the whole code. The buff I'm reading in contents 128
bytes/chars. But the pointer doesn't work and I dont know why. Do you
know what I mean?

Greets,

Werner

-----Original Message-----
From: en-nut-discussion-bounces at egnite.de
[mailto:en-nut-discussion-bounces at egnite.de] On Behalf Of Stefan Hax
Sent: Thursday, May 12, 2011 3:39 PM
To: Ethernut User Chat (English)
Subject: Re: [En-Nut-Discussion] pointer don't work?

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
> 
_______________________________________________
http://lists.egnite.de/mailman/listinfo/en-nut-discussion



More information about the En-Nut-Discussion mailing list