Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Sprintf .....

Reply
Thread Tools

Sprintf .....

 
 
Savio
Guest
Posts: n/a
 
      09-30-2005
Hi guys ,,

Can anyone out there tell me what is sprintf "

SAvio

 
Reply With Quote
 
 
 
 
Charles M. Reinke
Guest
Posts: n/a
 
      09-30-2005
"Savio" <> wrote in message
news: 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


 
Reply With Quote
 
 
 
 
Eric Sosman
Guest
Posts: n/a
 
      09-30-2005


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'.

--


 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      09-30-2005
"Savio" <> 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- <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.
 
Reply With Quote
 
Emmanuel Delahaye
Guest
Posts: n/a
 
      10-01-2005
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"


 
Reply With Quote
 
Mabden
Guest
Posts: n/a
 
      10-04-2005
"Savio" <> wrote in message
news: 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


 
Reply With Quote
 
Michael Mair
Guest
Posts: n/a
 
      10-04-2005
Mabden wrote:
> "Savio" <> wrote in message
> news: 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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a function similar to C++'s sprintf Pep Java 5 08-25-2005 08:23 PM
sprintf shea martin Java 5 09-03-2004 01:40 AM
difficulties with sprintf function Pilatus C++ 3 12-18-2003 07:00 PM
atoi: stringstream or old C sprintf function Mike Chirico C++ 2 11-19-2003 03:59 PM
String class, how to implement sprintf? CJ C++ 1 10-28-2003 10:54 PM



Advertisments
 



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