1) Don't use goto the way you are, it's not needed
2) Calling main is non-standard, don't do it
3) returnint( (char)main()) + ok;
Wtf is this?? Even if you could call main it makes no sense
I meant that last bit as a joke, but it still compiles under codeblocks using mingw32.
and also my code that I posted does in fact seem to work, but I don't understand why getsize(cin) is returning
-1
and I don't understand what cin.ignore(-1, '\n') is actually doing. Could it be that the prototype for cin.ignore() has some unsigned datatype that interprets -1 as a very large number? Because my call to empty(cin) seems to be clearing the buffer of all of its contents, i.e. its working as I would expect it to work as if getsize() was returning the size of the cin buffer (which it isn't).
So what is it doing?
And to be frank, I think it should be obvious what it is I'm trying to do, so would someone please kindly post correct code? i.e. returns the size of the cin.buffer and empties it?
After you pull data from the buffer it is "empty", yes it's true that physically there is still data in the memory there but as a general rule of computer science we functionally ignore quarks like this. Kind of like how we ignore that files aren't really deleted when you empty your recycle bin. It's up to the operating systems schedular to clear memory when a program exits (Warning that statement WILL start a flame war in certain circles), the only real obligation you have to the user is to ensure you don't leave any orphan threads in memory that the OS might think are still open.
So "to be frank" WTF (weak pun intended) are you trying to accomplish?
well anyways I've read the documentation for seekg and it states that it is a member of an istream object, and cin is an istream object, yet the above getsize() code works for fstreams, it doesn't work with cin, so what I'm trying to accomplish is find out why it is not working.