When using the sprintf function the converted results buffer contains a mixture of the correct converted results and the provided format parameters.
Example:
temp=123;
status=5;
bytecount=sprintf(buffer, "S,%d,%u,E",temp,status);
buffer should contain S,123,5,E
but
buffer contains S,%d,%u,E
Does anyone know why?
1 1393
When using the sprintf function the converted results buffer contains a mixture of the correct converted results and the provided format parameters.
Example:
temp=123;
status=5;
bytecount=sprintf(buffer, "S,%d,%u,E",temp,status);
buffer should contain S,123,5,E
but
buffer contains S,%d,%u,E
Does anyone know why?
I treid this and the buffer is containing the proper values as u have given in the code.
Raghuram
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Jim |
last post by:
im using asp.net, C# to enter data into a table in sql
server...however im getting this error:
Input string was not in a correct format.
Description: An unhandled exception occurred during the...
|
by: Huey |
last post by:
Hi All,
I saved hashed values of hex into buf, then buf becomes unreadable
by the means of calling puts(buf), printf("%s") and so on. Then, I
need to convert the hex in buf into a char buffer...
|
by: jimjim |
last post by:
Hello,
I was wondering about the implications of giving as an argument to sprintf a
different data type from the one specified in the format argument. This type
of question along with some...
|
by: aap |
last post by:
I have the following code
#define MAX 32
struct A
{
char carr;
int iarr;
int i;
};
void main()
{
|
by: Nanda |
last post by:
hi,
I am trying to generate parameters for the updatecommand
at runtime.
this.oleDbDeleteCommand1.CommandText=cmdtext;
this.oleDbDeleteCommand1.Connection =this.oleDbConnection1;...
|
by: Siv |
last post by:
Hi,
I have a stored procedure that I want to execute and then wait in a loop
showing a timer whilst it completes and then carry on once I get
notification that it has completed. The main reason...
|
by: Neal Barney |
last post by:
I have a C program which runs on a device using a Zilog Z180
microprocessor. While it can address 1MB of RAM, it can only address
64KB at any given time. And of that only 16KB can be used for...
|
by: krister |
last post by:
Hello,
I'm working in a quite large system that has some limitations. One of
those is that I can't use printf() to get an output on a screen. I'm
forced to use a special function, let's call it...
|
by: Olaf |
last post by:
Hi,
does exist a safe version/way of sprintf to prevent a buffer overflow by
using in this manner?
char* format = "0x%0.4X\n";
char buf;
sprintf(buf, format, number);
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
|
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...
|
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,...
| |