ところで、
>>44
> /* 文字列の長さ */
> for(str_length=0; str[str_length]; str_length++) {}

ではなく
str_length = sizeof (str) - 1;

だと思うが。