Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

mrtie_dye

_strupr

This topic is 5532 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

from a post long, long ago .....
quote:
Instead of doing your own DoUCase..... you can use _strupr(press) and continue.....
I was using the following to convert a string to uppercase letters
      

DoUcasePress(char press[])
{
	int a;
	for (a = 0; a < strlen(press); a++)
	{
		press[a] = (toupper(press[a]));
	}
	return press[strlen(press)];
}

      
Now that I have grown a little, I tried to use _strupr(press) When I do, it complains "Function '_strupr' should have a prototype in function blahblah()" What header file is needed for _strupr ? [edited by - mrtie_dye on May 26, 2003 11:13:40 PM]

Share this post


Link to post
Share on other sites
Advertisement
#include <string.h>

But as far as I know, it''s a Windows-only function.

If you''re using C++, try the STL :


#include <string>
#include <algorithm>
std::string DoUcasePress( char press[] )
{
std::string str( press );
std::transform( str.begin(), str.end(), str.begin(), toupper );

return str;
}

Share this post


Link to post
Share on other sites
If you just want to speed that up you should calculate "strlen(press)" once, rather than a times. Or, even better, just loop till you get to the null.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!