Original Post
Does anyone know how get the 10 from the char*
CAMERA10
quote:What does the 21st century have to do with being wasteful? Is being wasteful goin to be more accepted in the future? Don''t think so...
Original post by Anonymous Poster
Cybertron, didn''t you notice it''s already the 21st century?
// untested code
int StripNumber (char * s) {
for (; !isdigit(*s); s++)
;
return atoi(s);
}
quote:
Original post by Anonymous Poster
For example, the function you gave will make the program crash if the string doesn''t contain any numbers.
quote:
Original post by Russell For example, is it always going to be contiguous letters followed by a number? If so, you could do something like this
quote:
Original post by Russell
Besides, it depends what you''re doing. You talk about how horrible the security issues are from buffer overflows, and if I''m writing a web server, then maybe I need to think about that, and maybe I should also think about whether I want my web server''s performance to suffer from reallocating memory and copying strings left and right. Since most of us are not writing web servers, this probably isn''t that big of a deal.
This topic has been locked by a moderator. New replies are not allowed.
With your permission, GameDev.net uses analytics cookies to understand how people use the platform. You can accept analytics or continue with necessary cookies only. Learn more