Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   problem with vsprintf (http://www.go4expert.com/forums/problem-with-vsprintf-t4638/)

rajanandhini 12Jun2007 14:17

problem with vsprintf

When I try to compile the following code, I get an additional message from the buffer.

The code that we use has,
buf[0] = '\0';
va_start(va, fmt);
vsprintf(buf, fmt, va);

len = fprintf(work,"%s",buf);

The buffer should only contain the content of fmt. But, it also contains the text "parent information" along with the content of fmt. i.e, if the value of fmt is "hi", the value of buf should also be "hi". But the actual value that we get is, "parent informationhi".

Please help.



DaWei 12Jun2007 14:49

Re: problem with vsprintf
You don't give enough definition information. Please read the "Before you post a query" thread and learn to use code tags.

All times are GMT +5.5. The time now is 03:34.