Code:
std::istringstream ss(argv[2]);
ss >> blocks;
if (ss.fail() || 0 >= blocks) {
usage("Second parameter: must be a number,""and greater than zero"); // my custom method
return 1;
}
Here the line : ss>>blocks;
Can anyone please specify its working.
Isn't ss is the object, how come we are using it like this, aren't we supposed to use '.' to get the class variables or methods.
I am new to C++, cam from Java, so it's bit hard to get.
I have defined variable blocks as 1 as its initialized value. But it changes using ss >> blocks. I want to know the working of this line.
I understood below lines:
std::istringstream ss(argv[2]); // we are passing argument to constructor
ss >> blocks; // unable to get
ss.fail() // fail is the method in istringstream class which we are accessing using ss object.