what means operator *= in copy function?

Program of this program is to copy file. In the code I found the operator *=

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
  #include <iostream>
#include <fstream>
#include <conio.h>
using namespace std;
int main(int argc, char *argv[]) //  how many arguments recieved, arguments array
{
   if (argc != 3) // check that you used 2 arguments
   {
      cerr << "Syntaxe: " << argv[0] << " source target" << endl;
      return -1;
   }
   ifstream in(argv[1],ios::binary); // read data from input file (argument 1)
   ofstream out(argv[2],ios::binary);// write data to target file
   char buffer[1000];
   int count = 0;
   while (in && out)
   {  // std::istream::read  ,  std::istream::write	  
      in.read(buffer,1000); // read maximum 1000 bytes
	  // however write maximum of read bytes count
      out.write(buffer,in.gcount());// write byte to file
      count++; // count thousands
   }
   --count *= 1000;
   count += in.gcount();
   cout << "Bytes copied: " << count << endl;
   getch();
   return 0;
}


I understand that the count counts loops however I do not fully understand these two lines:
1
2
--count *= 1000; // why is here this line?
count += in.gcount(); // why is here this line? 


What purpose is of these two lines?
Last edited on
They're compound assignment operators.

It's the same as writing..
1
2
count = --count * 1000;
count = count + in.gcount();
Ah, I thought that the star is pointer :-)

BTW: How big buffer is optimal to copy files?
Last edited on
Topic archived. No new replies allowed.