Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4050560
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:05:06+00:00 2026-05-20T14:05:06+00:00

I was reading this page http://dev.mysql.com/doc/refman/5.0/en/mysql-fetch-row.html there is one line printf([%.*s] , (int) lengths[i],

  • 0

I was reading this page
http://dev.mysql.com/doc/refman/5.0/en/mysql-fetch-row.html
there is one line

printf("[%.*s] ", (int) lengths[i],
              row[i] ? row[i] : "NULL");

from code

    MYSQL_ROW row;
unsigned int num_fields;
unsigned int i;

num_fields = mysql_num_fields(result);
while ((row = mysql_fetch_row(result)))
{
   unsigned long *lengths;
   lengths = mysql_fetch_lengths(result);
   for(i = 0; i < num_fields; i++)
   {
       printf("[%.*s] ", (int) lengths[i],
              row[i] ? row[i] : "NULL");
   }
   printf("\n");

}

what does [%.*s] mean in that code ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T14:05:07+00:00Added an answer on May 20, 2026 at 2:05 pm

    [%.*s] is a printf format string meaning:

    • the first argument should be an integer (specifying maximum length of a string to print).
    • the second argument should be the string itself.
    • the [ and ] (and trailing space) are transferred as-is.

    Normally, you would see something like .7s which means a 7-character string. The use of * for the length means to take it from the argument given.

    So what that entire line does is to print a string , the length of which is found in lengths[i], and the value of which is row[i] (unless row[i] is NULL, in which case it uses the literal string "NULL").

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am reading this page http://www.cplusplus.com/doc/tutorial/exceptions.html it says if i write function() throw(); no
I was reading the tutorial on this page: http://edocs.bea.com/docs/cd/E13222_01/wls/docs81/medrec_tutorials/ejbgen.html#858279 And I have the following
I was reading this wikipedia page http://en.wikipedia.org/wiki/Hash_table There I fount this line The main
After reading this: http://docs.djangoproject.com/en/dev/ref/contrib/csrf/#how-to-use-it I came to the conclusion that it is not valid
I was reading this article on Coding Horror: http://www.codinghorror.com/blog/2008/04/setting-up-subversion-on-windows.html I went to the downloads
The current content of this google docs page is: alt text http://www.deviantsart.com/upload/i9k01q.png However, when
I am currently reading on Web Services. There is a SOAP tutorial at http://www.w3schools.com/soap/soap_intro.asp
After reading this article http://camendesign.com/code/developpeurs_sans_frontieres I have decided to follow what it says and
In this tutorial I am reading , Dave Ward creates a page that shows
I have a hard time reading open source file download pages like this http://rubyforge.org/frs/?group_id=167

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.