Hey guys just wondering is there a way to find the length of a int var in c++ like string.length() for strings?
Printable View
Hey guys just wondering is there a way to find the length of a int var in c++ like string.length() for strings?
Greetz Riot. :)
haven't properly checked but hopefully i've dug up a fairly useful url for you to take a gander at. ;)
http://oopweb.com/CPP/Documents/Thin...ume/chap07.htm
definitely a good link but not exactly what i was looking for what i mean was if i have something like:
int numbers;
cout << " Enter some number: ";
cin >> number;
I want to find out how many characters are being held in the var numbers.
This thread is a month old. But better late than never.
Ok. I found this site interesting. It might help with your question. Here is the link:
http://linuxshellaccount.blogspot.co...acters-in.html
Good luck.
Pay me!
You should study up on c and C++. Hope you were not talking about sizeof(int). Well here's a link that may help solve your vague question.Quote:
gcount Get number of characters extracted by last unformatted input operation (public member function)
http://www.cplusplus.com/reference/iostream/iostream/
BTW, possible buffer overflow! Think about it.