This what I get as an error message
WARNING (251) Can't preprocess format to (s)printf
using exact code mentioned on a previous thread.
char specifier[] = "%f";
char result[100];
float fnum = 3.14159;
sprintf( result,specifie r, fnum );
I am using zilog c compiler. Maybe its just a compiler. I'll try another compiler just for comparison. (MSF...
User Profile
Collapse
-
Thanks for reply,
I fixed code by changing char specifier to const char* specifier;
however,
sprintf(a,speci fier,b); will not compile because sprintf cannot parse specifier variable, it doesnt read the string value inside the specifier.
I guess the only option is to modify the sprintf funtion itself....Leave a comment:
-
Inserting format specifier from variable string value
Hi Everyone,
Is it possible to insert format specifier in a form of variable. See example below
Standard from
char result[100];
float fnum = 3.14159;
sprintf( result, "%f", fnum );
My question is
char specifier = "%f"; < - or specifier defined from input such as scanf(specifier )
char result[100];
float fnum...
No activity results to display
Show More
Leave a comment: