LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Advantage of Fmt over sprintf

Solved!
Go to solution

Are there advantages of using fmt over sprintf in CVI code? On the surface, they appear to be very similar down to the interpretation of the format string. I understand that the sprintf format string allows for more options, but those aren't always necessary in my projects.

 

0 Kudos
Message 1 of 5
(5,626 Views)
Solution
Accepted by topic author Les__Bartel

NI's recommendation is to use printf/scanf instead of Fmt/Scan, see the discussion here

Message 2 of 5
(5,623 Views)
I use Fmt and Scan mostly for the t (terminate) and d (discard) flags. I do not know their equivalent for sprintf. Fmt is much better documented than sprintf.
Does anybody have a full feature list of sprintf?
S. Eren BALCI
IMESTEK
0 Kudos
Message 3 of 5
(5,608 Views)

This Wikipedia page documents it. See also it's many references.

 

http://en.wikipedia.org/wiki/Printf_format_string

 

0 Kudos
Message 4 of 5
(5,603 Views)

As a side comment over Wolfgang note, look at the last comment by LuisG in the linked Idea exchange thread: Fmt/Scan are not to be considered obsolete or deprecated. It seems true, nevertheless, that no further addition is to be expected on these functions.

I am still using Scan sometimes in my programs as it appears to have a few more options than sscanf that are useful in some particular situations.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 5 of 5
(5,585 Views)