>>772
while( i <= max_len && isspace( str[i] ) )
を
while( i <= max_len && isspace( (unsigned char)str[i] ) )
に変えたらうまく動きました

どうもありがとうございます