c语言,s_gets()函数

char* s_gets(char* st, int n)
{
char* ret_val;+
int i = 0;

ret_val = fgets(st, n, stdin);
if (ret_val)
{
    while (st[i] != '\n' && st[i] != '\0')
        i++;
    if (st[i] == '\n')
        st[i] = '\0';
    else
        while (getchar() != '\n')
            continue;
}
return ret_val;

}

用这个函数时,假如我输入von Wurstkasse时,中间的空字符不会导致后面的Wurstkasse丢掉吗

不会的,因为你的输入是从文件内容来控制的,st是需要读入的字符串,n是字符串的长度。指定了读入长度,自然不会丢掉空格、换行这些字符。除非你的n只有3,这不太可能吧