size_tが何bitになるかは環境によって定義が異なります。 そのため、以下のコードは多くの32bit下で上手くいきますが、64bit化などで環境が変わると動かなくなります。 #include <string> int main () { std::string test = "test text"; unsigned int pos = 0; printf("size_t %lu\n", sizeof(size_t)); pos = test.find("ms"); printf("pos %lu, %lu\n", (size_t)pos, std::string::npos); if(pos != std::string::npos){ std::string text = test.substr(pos); printf("%s\n", text.c_str()); } retur