L
Lans Redmond
I have the following
ifstream in("abc.txt",ios::in)
char buff[8192];
if (!in)
{
cout << "error opening file" << endl;
}
while ( !in.eof())
{
in.read(buff,sizeof(buff));
int a = in.gcount();
int total += send (sock,buff,a,NULL);
}
in.close();
close(sock)
This is a windows program.
Now this is a simple read function that will read a file and devliver the
output through a socket. The in file is 50011 bytes. When this functions
ends my output is 48875bytes. I seem to be loosing bytes somewhere but cant
figure out where. When I look at the output it ending lines matches the
ending lines on the input, so it looks like I got the entire file. Any
ideas?
ifstream in("abc.txt",ios::in)
char buff[8192];
if (!in)
{
cout << "error opening file" << endl;
}
while ( !in.eof())
{
in.read(buff,sizeof(buff));
int a = in.gcount();
int total += send (sock,buff,a,NULL);
}
in.close();
close(sock)
This is a windows program.
Now this is a simple read function that will read a file and devliver the
output through a socket. The in file is 50011 bytes. When this functions
ends my output is 48875bytes. I seem to be loosing bytes somewhere but cant
figure out where. When I look at the output it ending lines matches the
ending lines on the input, so it looks like I got the entire file. Any
ideas?