C语言字符串函数s_gets()
C语言字符串函数s_gets()
《C Primer Plus》335-336页
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
原创
2021-09-23 22:26:07 ·
957 阅读 ·
0 评论