Connecting Tech Pros Worldwide Help | Site Map

toupper

  #1  
Old July 22nd, 2005, 07:48 AM
JasBascom
Guest
 
Posts: n/a
if i have

struct crecord{
char record_type;
}

if record_type = 'c';

how do I make record_type toupper?
  #2  
Old July 22nd, 2005, 07:48 AM
Sumit Rajan
Guest
 
Posts: n/a

re: toupper



"JasBascom" <jasbascom@aol.com> wrote in message
news:20040223215214.12245.00000328@mb-m02.aol.com...[color=blue]
> if i have
>
> struct crecord{
> char record_type;
> }
>
> if record_type = 'c';
>
> how do I make record_type toupper?[/color]



#include <iostream>
#include <cctype>

struct crecord {
char record_type;
};



int main()
{
crecord cr1, cr2;
cr1.record_type = 'c';
cr2.record_type = 'C';

cr1.record_type = std::toupper(cr1.record_type);
cr2.record_type = std::toupper(cr2.record_type);

std::cout << cr1.record_type << '\t' << cr2.record_type << '\n';

}


Regards,
Sumit.


  #3  
Old July 22nd, 2005, 07:48 AM
Mike Wahler
Guest
 
Posts: n/a

re: toupper



"JasBascom" <jasbascom@aol.com> wrote in message
news:20040223215214.12245.00000328@mb-m02.aol.com...[color=blue]
> if i have
>
> struct crecord{
> char record_type;
> }
>
> if record_type = 'c';
>
> how do I make record_type toupper?[/color]

#include <iostream>
#include <locale>

struct crecord
{
char record_type;
};

int main()
{
crecord rec = {'c'};
std::locale loc;
rec.record_type = std::toupper(rec.record_type, loc);
std::cout << rec.record_type << '\n'; /* prints 'C' */
return 0;
}


-Mike


Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
toUpper and pointer to a string gaga answers 16 September 23rd, 2007 09:35 PM
error trying to toupper string sandy@murdocks.on.ca answers 4 November 30th, 2006 12:35 AM
error trying to toupper string sandy@murdocks.on.ca answers 2 November 29th, 2006 04:15 AM
What's the deal with the "toupper" family? Frederick Gotham answers 48 July 13th, 2006 12:15 AM
ToUpper() Not working Shrinivas Reddy answers 0 November 16th, 2005 12:13 PM