strsafe.h functions - how to replace??
Hey, I have some example code that I'm trying to figure out from MSDN which uses functions from strsafe.h, but my compiler doesn't come with it and I don't particularly want to use the library. How would I replace the functions in it with functions from STL, or how do they work? My program uses StringCchPrintf,
StringCchLength, and StringCchCopy, and since I don't know exactly what they do beyond what their namesakes do, don't know how they work, and don't know where to download strsafe.h (I'm using dev-cpp, which doesn't come with it), I'm kind of stuck. Can I get some help, please? Thanks.
well yeah, but I'm talking about the functions, not the string class. I don't know what exactly StringCchPrintf, StringCchLength, and StringCchCopy do, and I need to find out.
so it just outputs to a console? I had already seen that page, I'm just trying to figure out what the function does that is visibly different from printf, if anything.
No, it prints to a buffer, as sprintf does.
StringCchPrintf → snprintf
StringCchLength → strnlen
StringCchCopy → strncpy
StringCchPrintf → snprintf
StringCchLength → strnlen
StringCchCopy → strncpy
Quote:Original post by Fruny
No, it prints to a buffer, as sprintf does.
StringCchPrintf → snprintf
StringCchLength → strnlen
StringCchCopy → strncpy
And therefore:
StringCchPrintf → cout.operator<< (and the appropriate stuff)
StringCchLength → (string object).length()
StringCchCopy → string object copy constructor
[smile]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement