On 11/20/2012 06:12 AM, Mark Woodward wrote: > On 11/20/2012 01:55 AM, David Kramer wrote: >> >> You probably want sprintf, which is like printf except it outputs a >> string instead of writing the output to stdout. >> >> http://www.cplusplus.com/reference/clibrary/cstdio/sprintf/ > > You never, ever, really never, want to use sprintf in any program. > Each and every occurrence of "sprintf" should be replaced by snprintf > as soon as possible. The sprintf call is unbounded is a stability risk > as well as a potential security hole. C++ native strings are identical to C language strings using all the C library functions, but there is a very rich C++ string class that is part of the STL (standard template Library)(std::string). http://www.cplusplus.com/reference/string/string/
IMHO, as a long time contractor I always recommend coding in the same style that is prevalent in the companies that I have worked in. When coding in C++ I rarely use the C language strings or printfs. Again, from a purist standpoint, in C++ you should generally use the cout set of input/output operators. -- Jerry Feldman <[email protected]> Boston Linux and Unix PGP key id:3BC1EB90 PGP Key fingerprint: 49E2 C52A FC5A A31F 8D66 C0AF 7CEA 30FC 3BC1 EB90
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Hardwarehacking mailing list [email protected] http://lists.blu.org/mailman/listinfo/hardwarehacking
