JOIN
Get Time
forums   
Search | Watch Thread  |  My Post History  |  My Watches  |  User Settings
View: Flat (newest first)  | Threaded  | Tree
Previous Thread  |  Next Thread
C++ function errors | Reply
In the first practice room i was unuable to use a couple of functions like:

stricmp, itoa, strlwr

Am I doing something, I can get uses these functions in other compilers. Please help.
Re: C++ function errors (response to post by Mugushoo) | Reply
None of those are functions in the standard C or C++ library, according to my man pages.

Either you are confusing your function names, or you are used to using some non-standard library that the rest of the world (including TC) doesn't support. Perhaps if you specify which "other compilers" you mean, someone who has used it could suggest other alternatives.

Instead of stricmp, try using strncmp:
int strncmp(const char *s1, const char *s2, size_t n);
in <strings.h>. Bear in mind that C++ strings are generally friendlier to work with; you could also use their substr() member function. More details on STL strings are available at www.sgi.com/tech/stl.

Instead of itoa, use sprintf:
int x=500;
char buf[10];
bzero(buf,10);
sprintf(buf,"%d",x);

I've never heard of strlwr, but if it's intended to convert to lower case, consider the tolower() function in <ctype.h>, though it only works on single characters. The common sense approach works too; identify lower case letters by >= and <=, then add 'a' and subtract 'A'.