这个小程序有什么问题。。。貌似四内存泄露?
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <Winsock2.h>
void main()
{
FILE* userfile = NULL;
userfile = fopen("data.txt", "r");//只读打开文件
if(userfile == NULL)
return;
char buffer[256]= {0};
int c = 0;
int cnt = 0;
while(!feof(userfile))
{
while( (c = fgetc(userfile)) != '\n' )
{
if((char)c !=' ')
buffer[cnt++] = (char)c;
}
printf("%s\n",buffer);
cnt=0;
//send(buffer);
}
fclose(userfile);
return;
}
//data.txt内容 如下
12 34 41 42 07