473,699 Members | 2,768 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Convert char* to upper case

Hi,

For some reason I am blanking this Friday morning. I have a class
constructor call Point as shown below. Trying to figure out how I can
make the arguments passed in all upper case before I set the member
variables.

Thanks for the insight.

RishiD

Point(const char* name,
const char* description,
const char* iomid,
const char* address,
const char* type,
Event* event)
{
m_strName = name;
m_strDesc = description;
m_strAddress = address;
m_strType = type;
m_strParentName = iomid;
m_Event = event;
}

Feb 16 '07 #1
13 23780
RishiD <ri****@gmail.c omwrote:
For some reason I am blanking this Friday morning.
Starting with posting code that seems a little like C++ to
comp.lang.c? (It has indeed been a lengthy week.)
I have a class
constructor call Point as shown below. Trying to figure out how I can
make the arguments passed in all upper case before I set the member
variables.
There's no builtin C function to do this, but you could write one
using the builtin toupper() for characters. Alternatively, there
might be a C++ way to do this, if you are indeed writing C++ as it
seems.

--
C. Benson Manica | I *should* know what I'm talking about - if I
cbmanica(at)gma il.com | don't, I need to know. Flames welcome.
Feb 16 '07 #2
RishiD said:
Hi,

For some reason I am blanking this Friday morning. I have a class
constructor call Point as shown below.
....which makes me think you're using C++, so I've cross-posted this
reply to comp.lang.c++, and set followups to that group.
Trying to figure out how I can
make the arguments passed in all upper case before I set the member
variables.
In C, you'd probably write a function that calls toupper() in a loop -
but in C++ there may be a more C++y way to do it.

[Remainder of your article retained, for clc++'s convenience. Hi guys,
long time no see.]
>
Thanks for the insight.

RishiD

Point(const char* name,
const char* description,
const char* iomid,
const char* address,
const char* type,
Event* event)
{
m_strName = name;
m_strDesc = description;
m_strAddress = address;
m_strType = type;
m_strParentName = iomid;
m_Event = event;
}
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Feb 16 '07 #3
Christopher Benson-Manica wrote:
>RishiD <ri****@gmail.c omwrote:
>>... Trying to figure out how I can
make the arguments passed in all upper case before I set the member
variables.

There's no builtin C function to do this, but you could write one
using the builtin toupper() for characters. Alternatively, there
might be a C++ way to do this, if you are indeed writing C++ as it
seems.
[OT] That would be, surprisingly, the toupper(c) or toupper(begin,e nd)
services provided in <ctype>

Roberto Waltman

[ Please reply to the group,
return address is invalid ]
Feb 16 '07 #4
RishiD wrote:
Hi,

For some reason I am blanking this Friday morning. I have a class
constructor call Point as shown below. Trying to figure out how I can
make the arguments passed in all upper case before I set the member
variables.

Point(const char* name,
const char* description,
const char* iomid,
const char* address,
const char* type,
Event* event)
{
m_strName = name;
m_strDesc = description;
m_strAddress = address;
m_strType = type;
m_strParentName = iomid;
m_Event = event;
}
#include <ctype.h>

void up(char *q)
{
unsigned char c;

while (*q) { c = *q; *q = toupper(c); q++; }

return;
}

Also your function specifies "const char *". You might want to adhere to that.
Feb 16 '07 #5
Roberto Waltman wrote:
[OT] That would be, surprisingly, the toupper(c) or toupper(begin,e nd)
^^^^^^^^^^^^^^^ ^^^

???
Feb 16 '07 #6
Christopher Layne wrote On 02/16/07 11:07,:
Roberto Waltman wrote:

>>[OT] That would be, surprisingly, the toupper(c) or toupper(begin,e nd)

^^^^^^^^^^^^^^^ ^^^

???
Go back and read Roberto's message again, this time
paying attention to the text he quoted and responded to.

--
Er*********@sun .com
Feb 16 '07 #7
Eric Sosman wrote:
Christopher Layne wrote On 02/16/07 11:07,:
Roberto Waltman wrote:

>[OT] That would be, surprisingly, the toupper(c) or toupper(begin,e nd)
^^^^^^^^^^^^^^^ ^^^

???

Go back and read Roberto's message again, this time
paying attention to the text he quoted and responded to.
The C++ part? toupper(begin,e nd) is new to me if it's valid at all,
regardless of which language is used.

Feb 16 '07 #8
Eric Sosman wrote:
Christopher Layne wrote On 02/16/07 11:07,:
Roberto Waltman wrote:

>[OT] That would be, surprisingly, the toupper(c) or toupper(begin,e nd)
^^^^^^^^^^^^^^^ ^^^

???

Go back and read Roberto's message again, this time
paying attention to the text he quoted and responded to.
The C++ part? toupper(begin,e nd) is new to me if it's valid at all,
regardless of which language is used.

Feb 16 '07 #9
Roberto Waltman wrote:
Christopher Layne wrote:
Roberto Waltman wrote:
[OT] That would be, surprisingly, the toupper(c) or toupper(begin,e nd)
^^^^^^^^^^^^^^^ ^^^
[un-snip]
services provided in <ctype>

Off-topic, wearing a C++ hat:
From Josuttis "The C++ Standard Library", 1st ed, 10th printing, page
716.

The facet ctype is a template class parameterized with a character
type...
...
Table 14.16. Services defined by the ctype<charTFace t
...
ct.toupper(beg, end) Converts each letter in the range between beg and
end by replacing the letter with the result of toupper()
Oh, provided by a ctype class, not provided by any <ctypeheader... ?

Feb 16 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
13067
by: programmerforhire | last post by:
Hello all, Is there a way to setup an ms-access table so that when I enter text in the 'datasheet' mode, it will automatically be converted tp upper case. Or must I use a Form for this? rex
3
13924
by: Addio | last post by:
Hello, MSA Group, Does anyone know how to convert all UPPER CASE text to Initial Caps? I'm familiar with ucase and lcase, but don't know of any function to handle Initial Caps, i.e. every word between non breaking spaces are Capitalized. Thx, Addio
17
11221
by: Janice | last post by:
char* line = "abcd"; How to convert the line to upper case and print? Any option for printf to do this? Thanx
6
12552
by: Manish | last post by:
In my application there is need for only upper case chars.. Currently I am making entry to upper case when user leaves focus of the text control. I want to do some modification here...When user enters any char in small case...during that entry it should convert in upper case... It is very easy in VB6..In VB6 you just need to convert the Ascii value to char ---> then to Ucase ---> then char to Ascii again...this can be done in keypress...
5
1179
by: Mariame | last post by:
Hi Everyone, Is There a way to eliminate upper case, so the user could only write Lower Case or to transfer the Upper Case String to lower case in Visual Basic ???? Thx in Adv.
19
26443
by: Eric Lindsay | last post by:
Should HTML 4.01 Strict markup be done in upper case or in lower case? I understand that HTML allows either upper or lower case. I also notice that XHTML apparently requires lower case. However I saw some mention that the HTML DOM uses upper case for markup elements. So, should I worry about what this means? I am inclined to go with lower case, for two reasons. Easier to change if I subsequently want to use XHTML.
8
20292
by: csanjith | last post by:
Hi, i have a situaion where i need to convert the characters entered in an text field to upper case using C. The configuration id utf8 environment in which user can enter any character (single , double, triple byte etc). I need to convert to upper case only those characters which has got upper case. ie if an user enter bot english and japanese characters in the text field, then I should convert only english characters, not japanese.
5
3675
by: conan9 | last post by:
Hi folks,, I'm new here and having trouble to compile uppercase .... and here is my code: #include <iostream> #include <string> #include <iomanip> #include <algorithm>
6
3116
by: lenniekuah | last post by:
Hullo Awesome Helpers, Thank you for helping me earlier. I am back with new problem. I am trying to covert a TEXT String into either Lower and Upper case characterS. (Upper case Eg. ALFRED instead of alfred) (Lower case Eg. thompson instead of THOMPSON ) Please help me. Coding //convert to lower case string strName = lcase(this.txtName.text) <-- not working
0
8686
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9173
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9033
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8882
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7748
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4375
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3057
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2345
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2009
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.