D
Duane
Aside from the pitfalls of using this function,
according to the standard, what is the correct
way to call it?
#include <string>
#include <locale>
// seems to work with BCC5.6/STLPort
void stringToUpper(std::string &str) {
for(size_t i = 0, len = str.size(); i < len; ++i)
str = std::toupper(str);
}
// comeaux throws an error about the arg list
// but this seems to compile
void stringToUpper(std::string &str) {
for(size_t i = 0, len = str.size(); i < len; ++i)
str = std::toupper(str, std::locale(0));
}
For MSVC6, it complains that toupper() is not
a member of std.
In each case, including <ctypes.h> and removing
the std specifier seems to compile the first example.
Which is correct?
according to the standard, what is the correct
way to call it?
#include <string>
#include <locale>
// seems to work with BCC5.6/STLPort
void stringToUpper(std::string &str) {
for(size_t i = 0, len = str.size(); i < len; ++i)
str = std::toupper(str);
}
// comeaux throws an error about the arg list
// but this seems to compile
void stringToUpper(std::string &str) {
for(size_t i = 0, len = str.size(); i < len; ++i)
str = std::toupper(str, std::locale(0));
}
For MSVC6, it complains that toupper() is not
a member of std.
In each case, including <ctypes.h> and removing
the std specifier seems to compile the first example.
Which is correct?