473,387 Members | 3,781 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

fprintf

41
Hi,

I am using sprintf like so where i want my numeric to be converted to a string
char string[100];
int result;
ret = sprintf(string, "%d", result);

does any one know if this will cause a memory leak ????


Another question.

is I have the following scenario -1234 is a numeric
I want to convert this to a string like so "-1234"

What would be the best c function to do this ????
Jan 18 '07 #1
1 974
radders
13
Another question.

is I have the following scenario -1234 is a numeric
I want to convert this to a string like so "-1234"

What would be the best c function to do this ????
I think itoa would do it in C++, but not sure about C...on the other hand I've only just started programming so i could be wrong - hope not!!
Radders
Jan 18 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: hpy_awad | last post by:
I am writing stings ((*cust).name),((*cust).address)to a file using fgets but rabish is being wrote to that file ? Look to my source please and help me finding the reason why this rabish is being...
8
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...
3
by: Andrew Fabbro | last post by:
I have code with stuff like this all over it: sprintf(errmsg,"somefunc(): %s has illegal character %c",somestring,somechar); fatal_error(errmsg); where fatal_error() just fprintf's to stderr...
6
by: Magix | last post by:
Hi, I want to use fprintf to write to a file. My question about the formatted output How can I format so that I can allocate certain width for each %s (Left-aignlied) ? Example: fprintf("%s...
17
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...
4
by: baumann | last post by:
hi all, i want to use the fprintf to make log. if defined LOG_TO_FILE, it is easy to use fprintf to write the log file. if not defined LOG_TO_FILE, i want to simply write to error std...
4
by: grimrob | last post by:
fprintf just is not working. I am using PHP Version 4.3.9. Whatever I do fprintf just fails. For example: fwrite($Handle, 'A1'); fprintf($Handle, 'A2); The first line always works, the...
16
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...
11
by: David Mathog | last post by:
In the beginning (Kernighan & Ritchie 1978) there was fprintf, and unix write, but no fwrite. That is, no portable C method for writing binary data, only system calls which were OS specific. At...
3
by: vamsi | last post by:
Hi, I have a program, where involves creation of a thread with stack size of 16k(minimum stack size). There is an fprintf statement in the created thread code. I see that there is a core dump...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
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...
0
Oralloy
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.