I use the Oracle API to access the database, and this API has a readBuffer(char * buffer, unsigned int size); function readBuffer(char * buffer, unsigned int size); to which I cannot make any changes.
I have a class that uses this API, and the signature of my function currently takes std::string and unsigned int for size, the problem is that when I pass std::string.size() the size argument of my function, I I get a warning from my compiler that converting from size_t to unsigned int could result in data loss.
I wondered if there is a valid way to convert size_t to unsigned int , so I can pass it to my API and not get a warning from the compiler?
I understand that the purpose of size_t and google search for this conversion leads to a large number of results that say "change the function to accept the argument size_t", but I CANNOT change the signature of my API in this case.
Any suggestions?
source share