Do so

char * buff = new char[a]; b = fread(&buff[0],1,a,in); 

for some reason b = 0

 in = fopen(filename, "r"); int b; while(b = fread(&buff[0],1,a,in)) { send(client_socket,&buff[0],b,0); i++; printf("Отправляем %d блок файла \n", i); } 
  • And what is a? And yet, did the in file exactly open normally? - alexlz
  • a = 512 here for the other file is now normal, b = 422 is recorded, only an infinite loop goes, here is the code int i = 0; int b; int a = atol (buffer); char * buff = new char [a]; // b = fread (& buff [0], 1, a, in); // b ++; while (feof (in)) {b = fread (& buff [0], 1, a, in); send (client_socket, & buff [0], b, 0); i ++; printf ("Send% d file block \ n", i); } - AnnaHatiko
  • and for textual D: \ data.txt, for example, b = 0 is written (( - AnnaHatiko
  • I will not be on the Internet until Monday now (if I decide myself - it will be cool, but anyway - who has any thoughts on how to fix it - write .. - AnnaHatiko
  • I am very sad, you will be greatly missed. But - happy weekend. Now. while(feof(in)) or while(!feof(in)) ? (1). D:\data.txt as entered? If as a constant in the program, how many backslashes (``) are there? (This is a common mistake) - alexlz

0