Clearing C++ input buffer after validation and measuring program resource use

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 2K views
Hypercase
Messages
63
Reaction score
0
I,m writting code in C/C++ and when i validate my enteries(ensure they are numeric) i use !cin.good().

Also how do i clear the buffer after an invalid entry?
I usually use cin.seekg(0);cin.clear(); How do they work?
Is there a better way?

How do i find out how much processing power and memmory my prog uses as it runs?

-01000011 01101000 01100101 01100101 01110010 01110011.
 
Physics news on Phys.org
You need what is called a memory profiler. I know under linux there is memprof and under visual studios 6 I think the program is called spy or something or other (Don't quote me on this).