C/C++ 读入一行字符串
标签(空格分隔): 常用代码积累
1.gets
gets函数的头文件是
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
int size = 1024;
char* buff = (char*)malloc(size);
// read lines
while(NULL != gets(buff)){
printf("Read line with len: %d\n", strlen(buff));