词条 | cgets |
释义 | § 函数名 cgets § 功能 从控制台读字符串 § 函数语法 char *cgets(char *str); § 程序演示 #include #include int main(void) { char buffer【83】; char *p; /* There's space for 80 characters plus the NULL terminator */ buffer【0】 = 81; printf("Input some chars:"); p = cgets(buffer); printf("\cgets read %dcharacters: \\"%s\\"\", buffer【1】, p); printf("The returned pointer is %p, buffer【0】 is at %p\", p, &buffer); /* Leave room for 5 characters plus the NULL terminator */ buffer【0】 = 6; printf("Input some chars:"); p = cgets(buffer); printf("\cgets read %d characters: \\"%s\\"\", buffer【1】, p); printf("The returned pointer is %p, buffer【0】 is at %p\", p, &buffer); return 0; } |
随便看 |
百科全书收录594082条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。