Re: SSCANF
Superfox il Volpone wrote:[color=blue]
> Sorry people, what I posted it's part of a more large program and the
> printf with I verified it was wrong :)
>
> I solved but I don't understand one thing :
> the sscanf works with '&mese' and 'mese' in the correct manner : maybe
> it's the compiler (GCC) that does some correction ?[/color]
No. If mese is an array, then mese and &mese are the same thing.[color=blue]
>
> The second thing if I want to jump one argument is it correct the
> behaviour ?
> year[5]
> sscanf(str_date , "%*s/%4s", year);[/color]
Yes, if you change your format string to "%*2s/%4s"[color=blue]
>
> and at last, at year will be placed the string terminator ('\0')[/color]
mese and year will have been terminated with '\0' in any case.[color=blue]
>
> Bye & thx all for the help
> ~ Superfox il Volpone :)
>[/color]
Superfox il Volpone wrote:[color=blue]
> Sorry people, what I posted it's part of a more large program and the
> printf with I verified it was wrong :)
>
> I solved but I don't understand one thing :
> the sscanf works with '&mese' and 'mese' in the correct manner : maybe
> it's the compiler (GCC) that does some correction ?[/color]
No. If mese is an array, then mese and &mese are the same thing.[color=blue]
>
> The second thing if I want to jump one argument is it correct the
> behaviour ?
> year[5]
> sscanf(str_date , "%*s/%4s", year);[/color]
Yes, if you change your format string to "%*2s/%4s"[color=blue]
>
> and at last, at year will be placed the string terminator ('\0')[/color]
mese and year will have been terminated with '\0' in any case.[color=blue]
>
> Bye & thx all for the help
> ~ Superfox il Volpone :)
>[/color]
Comment