How to solve this?

This is a discussion on How to solve this? within the C Programming forums, part of the General Programming Boards category; Originally Posted by fenikkusu Thank you all. But I have never heard about this function snprintf(list[i].st,sizeof list[i].st,"C%02d",i+1); Can you clarify ...

  1. #16
    Registered User
    Join Date
    Oct 2008
    Location
    TX
    Posts
    2,047
    Quote Originally Posted by fenikkusu View Post
    Thank you all. But I have never heard about this function snprintf(list[i].st,sizeof list[i].st,"C%02d",i+1); Can you clarify it for me?
    snprintf() belongs to the printf() family and instead of writing to the stdout stream it stores its output in the char array specified by its first argument. It is the safer version of sprintf() as the latter can try to store more than can fit inside its first argument. You should make the size of the array char id[] one more than the length of the data to allow for the trailing null.
    Last edited by itCbitC; 01-08-2009 at 10:36 AM.

  2. #17
    Registered User fenikkusu's Avatar
    Join Date
    Jan 2009
    Posts
    12
    ok. Thanks for your explanation. I also googled it and gave it a shot

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. can anyone solve this for me? (look inside)
    By johnsonswww in forum C Programming
    Replies: 10
    Last Post: 03-02-2009, 10:24 AM
  2. Replies: 2
    Last Post: 04-25-2005, 11:59 AM
  3. How to handle in software to solve this block diagram?
    By vnrabbit in forum C Programming
    Replies: 4
    Last Post: 02-13-2003, 01:45 PM
  4. Help to solve this problem
    By Romashka in forum C++ Programming
    Replies: 3
    Last Post: 04-16-2002, 09:32 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21