Hi all,
I saw the following line in a C source. what's the asterisk * mean?
Thank you!
fprintf(conn_ou t, "%.*s\r\n", (int)(strlen(bu f + 1) - 1), buf + 1); 2 2675
Marco <98*****@sohu.c om> wrote: I saw the following line in a C source. what's the asterisk * mean?
fprintf(conn_ou t, "%.*s\r\n", (int)(strlen(bu f + 1) - 1), buf + 1);
This really should be in your C textbook. (If you haven't got one, I
recommend, obviously, K&R 2.) It's also in the last public draft of the
C99 Standard: <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n869/>.
Basically, if either the field width or the precision of a conversion
specifier is an asterisk, there's another argument (an int) that
provides the value of that part of the specifier.
In this case, the precision of your string argument, which is the
maximum number of chars to write, is given by the (int)(strlen(bu f+1)-1)
argument. The result is that the whole string starting at buf+1 is
written, except for the last character.
Richard
Thanks
Richard Bos wrote: Marco <98*****@sohu.c om> wrote:
I saw the following line in a C source. what's the asterisk * mean?
fprintf(conn_ out, "%.*s\r\n", (int)(strlen(bu f + 1) - 1), buf + 1);
This really should be in your C textbook. (If you haven't got one, I recommend, obviously, K&R 2.) It's also in the last public draft of the C99 Standard: <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n869/>.
Basically, if either the field width or the precision of a conversion specifier is an asterisk, there's another argument (an int) that provides the value of that part of the specifier. In this case, the precision of your string argument, which is the maximum number of chars to write, is given by the (int)(strlen(bu f+1)-1) argument. The result is that the whole string starting at buf+1 is written, except for the last character.
Richard This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: sarmin |
last post by:
Hi Pythoners...
It seems to me the Asterisk (*) sign in python means many things...
if a python code line looks like this:
def__init__(self, func, *param):
bla bla bla...
and then u have something like this:
func(*param)
|
by: Smegly |
last post by:
Hi,
I'm confused about a situation i have ..
fprintf works in one function, but not in the other . .
This is my part of my code for the two functions ..
void customer(FILE *fin, FILE *fout, int msqid, message_buf sbuf, size_t
|
by: G Patel |
last post by:
E. Robert Tisdale wrote:
>
> int main(int argc, char* argv) {
> quad_t m = {0, 1, 2, 3};
> int r;
> fprintf(stdout, "m = (");
> for (size_t j = 0; j < 4; ++j)
Why did you declare j as type size_t ?
|
by: Robert M |
last post by:
Hello,
I am having a problem when I enter a new row using data grid footer and the
data contains asterisk ('). I can use replace function, and it will not
crash the program but it shows 2 asterisk (' '). Actually it does not happen
in all footers and I can not find what is the difference, unless I turn some
property true...
Help is very much appreciated
Thank u
|
by: Evan |
last post by:
I am trying to put an asterisk in the Label text property but the asterisk
doesn't show up in the correct place.
If I enter "* hello" in the text property (using the designer property
pages) the label is displayed as "hello *". If I enter "3 * hello" the label
is displayed as "hello * 3".
How I get the asterisk to display in the proper location?
Thanks in advance.
| |
by: selvarani |
last post by:
Hi all,
I am a newbie to Asterisk and PHP. I have installed wamp5_1.4.3 and working with PHP on this. I would like to write a PHP script to interact with asterisk. Where are the Manager API's used. How come the PHP script and Asterisk Manager API's interact? What should the script do exactly? Anyone help me out. Thanks in advance.
|
by: Prayag Narula |
last post by:
Hi,
I want to redefine fprintf for debugging purposes. That is I want that
all the output that is going to the stdout should be logged in a
file.
I tried something like
#define fprintf (x,y,z) my_fprintf(x,y,z)
|
by: striker07 |
last post by:
Someone help me how can i display a diamond shaped asterisk correctly pls. correct my program
this is my code:
Dim ctr, space, asterisk As Integer
For ctr = 1 To 9 Step 2
For space = (9 - 2) / 2 To 0
LstDisplay.AddItem (" ")
Next
For asterisk = 1 To ctr
|
by: Coll |
last post by:
I'm working with a form & a query that allows the user to filter the
data using several combo boxes. One of the combo boxes allows them to
select the first letter of a a particular field, and it will use that
first letter in the criteria of the query to include only records with
a value beginning with that letter. The tricky part is that one of the
possible values for that field is - *.* - not values I would have
chosen, but they are...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |