Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C Programming (http://www.velocityreviews.com/forums/f42-c-programming.html)
-   -   Sprintf ..... (http://www.velocityreviews.com/forums/t439608-sprintf.html)

Savio 09-30-2005 05:29 PM

Sprintf .....
 
Hi guys ,,

Can anyone out there tell me what is sprintf "

SAvio


Charles M. Reinke 09-30-2005 05:44 PM

Re: Sprintf .....
 
"Savio" <saviochacko@gmail.com> wrote in message
news:1128101348.959993.56630@g47g2000cwa.googlegro ups.com...
> Hi guys ,,
>
> Can anyone out there tell me what is sprintf "
>
> SAvio
>


Try this link: http://ccs.ucsd.edu/c/stdio.html#sprintf

This one might help too, although itz technically specific to the Linux OS:
http://man.he.net/?topic=sprintf&section=all

By the way, quite often with questions like this Goggle is your friend.

-Charles



Eric Sosman 09-30-2005 05:48 PM

Re: Sprintf .....
 


Savio wrote On 09/30/05 13:29,:
> Hi guys ,,
>
> Can anyone out there tell me what is sprintf "


Like printf(), except that its "output" goes into a
character array that you provide instead of being sent
to stdout. The array must be large enough to hold all
the characters plus a terminating '\0'.

--
Eric.Sosman@sun.com


Keith Thompson 09-30-2005 08:29 PM

Re: Sprintf .....
 
"Savio" <saviochacko@gmail.com> writes:
> Hi guys ,,
>
> Can anyone out there tell me what is sprintf "
>
> SAvio


Does your C implementation include documentation? On any Unix-like
system, "man sprintf" should provide all the information you need; I
don't know about other systems.

Any decent book on C should explain sprintf. If you don't have a
decent C book, you should get one. Kernighan & Ritchie's _The C
Programming Language_, 2nd Edition, is an excellent tutorial.
Harbison & Steele's _C: A Reference Manual_, 5th Edition, is an
excellent reference.

You're posting through groups.google.com. You should be aware that
Google also provides an excellent web search engine.

There are all things you should try *before* posting to Usenet.

--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.

Emmanuel Delahaye 10-01-2005 07:35 AM

Re: Sprintf .....
 
Savio wrote on 30/09/05 :
> Can anyone out there tell me what is sprintf "


Please open your C-book.

--
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html
The C-library: http://www.dinkumware.com/refxc.html

"C is a sharp tool"



Mabden 10-04-2005 09:37 AM

Re: Sprintf .....
 
"Savio" <saviochacko@gmail.com> wrote in message
news:1128101348.959993.56630@g47g2000cwa.googlegro ups.com...
> Hi guys ,,
>
> Can anyone out there tell me what is sprintf "


printf() writes a string to the output (the screen or whatever).
sprintf() writes one string into another string. Remember, you have to
allocate memory for the string you write to!

You use it to build a string you want to output later, so if you might
want to put the first name, then the last name, then the zodiac sign
into a string, you would use sprintf() to do it.

--
Mabden



Michael Mair 10-04-2005 06:10 PM

Re: Sprintf .....
 
Mabden wrote:
> "Savio" <saviochacko@gmail.com> wrote in message
> news:1128101348.959993.56630@g47g2000cwa.googlegro ups.com...
>
>>Hi guys ,,
>>
>> Can anyone out there tell me what is sprintf "

>
>
> printf() writes a string to the output (the screen or whatever).
> sprintf() writes one string into another string. Remember, you have to
> allocate memory for the string you write to!
>
> You use it to build a string you want to output later, so if you might
> want to put the first name, then the last name, then the zodiac sign
> into a string, you would use sprintf() to do it.


Apart from that: If you use a C99 implementation or if your standard
library contains the function, use snprintf() instead of sprintf()
as you can easier avoid buffer overflows and similar -- and have
a chance to find out that the output has been truncated.

See for example the excellent C99 library reference at dinkumware.com
for more information.


Cheers
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.


All times are GMT. The time now is 09:08 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57