Hello there! I come across this function and I was having a hard time dealing with it because it has two function prototype.

int swprintf(wchar_t* buffer, const wchar_t* format[, ...argument])
and
int swprintf(wchar_t* buffer, size_t count, const wchar_t* format[, ...argument])

I used the first one in Windows and it worked fine, but when I used it in Linux, it gives me the error "invalid conversion from const wchar_t* to size_t. So I decided to use the second one and it compiled well. I just would like to ask if there is a difference between the two. Thanks!

There is a difference. Lol, what I meant was what is their difference that Linux cannot use the first one and vice versa. :)

Well this is the C++ forum, so use C++ functionality?

According to C99, the second one is correct.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.