473,396 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Source Code for toUpper Function

I am learning C++, so please be kind. Is there anywhere that I can
view the source code for the toUpper function? Thanks.

Dec 11 '06 #1
13 8598

Ja********@gmail.com wrote:
I am learning C++, so please be kind. Is there anywhere that I can
view the source code for the toUpper function? Thanks.
You can download the standard C library with GCC.

Dec 11 '06 #2
Ja********@gmail.com wrote:
I am learning C++, so please be kind. Is there anywhere that I can
view the source code for the toUpper function? Thanks.
There is no "the source". Each implementation is free to write it the
way they want, as long as the behavior is what the standard requires.
For instance, one that uses ASCII might take a peek its current value
and subject a set value if its currently in the "lowercase" range.

Try doing a search for toupper.c to find some implementations.


Brian

--
Please don't top-post. Your replies belong following or interspersed
with properly trimmed quotes. See the majority of other posts in the
newsgroup, or the group FAQ list:
<http://www.parashift.com/c++-faq-lite/how-to-post.html>
Dec 11 '06 #3

Ja********@gmail.com wrote:
I am learning C++, so please be kind. Is there anywhere that I can
view the source code for the toUpper function? Thanks.
Never heard of toUpper.

Take a look at ctype.h for a C answer and note that toupper(...)
becomes std::toupper(...) according to <cctype>.

Dec 11 '06 #4
Salt_Peter wrote:
>
Ja********@gmail.com wrote:
I am learning C++, so please be kind. Is there anywhere that I
can view the source code for the toUpper function? Thanks.

Never heard of toUpper.

Take a look at ctype.h for a C answer and note that toupper(...)
becomes std::toupper(...) according to <cctype>.
How likely is that to give the OP the source code for the function?


Brian
Dec 11 '06 #5

Default User wrote:
Salt_Peter wrote:

Ja********@gmail.com wrote:
I am learning C++, so please be kind. Is there anywhere that I
can view the source code for the toUpper function? Thanks.
Never heard of toUpper.

Take a look at ctype.h for a C answer and note that toupper(...)
becomes std::toupper(...) according to <cctype>.

How likely is that to give the OP the source code for the function?
It should, it does here. And since C++ nor C are proprietary, hidden
implementations, if its not found there on his platform, it most
certainly will be found elsewhere.

Dec 11 '06 #6
Salt_Peter wrote:
>
Default User wrote:
Salt_Peter wrote:
>
Ja********@gmail.com wrote:
I am learning C++, so please be kind. Is there anywhere that
I can view the source code for the toUpper function? Thanks.
>
Never heard of toUpper.
>
Take a look at ctype.h for a C answer and note that toupper(...)
becomes std::toupper(...) according to <cctype>.
How likely is that to give the OP the source code for the function?

It should, it does here.
It does? Where is "here"? I've not seen source code for library
functions in headers in any implementation I've ever used.
And since C++ nor C are proprietary, hidden
implementations, if its not found there on his platform, it most
certainly will be found elsewhere.
Say what? The implementations more certainly are proprietary, and are
often not distributed. Where did you get the idea that it was otherwise?


Brian
Dec 11 '06 #7

Default User wrote:
Salt_Peter wrote:

Default User wrote:
Salt_Peter wrote:
>

Ja********@gmail.com wrote:
I am learning C++, so please be kind. Is there anywhere that
I can view the source code for the toUpper function? Thanks.

Never heard of toUpper.

Take a look at ctype.h for a C answer and note that toupper(...)
becomes std::toupper(...) according to <cctype>.
>
How likely is that to give the OP the source code for the function?
>
It should, it does here.

It does? Where is "here"? I've not seen source code for library
functions in headers in any implementation I've ever used.
And since C++ nor C are proprietary, hidden
implementations, if its not found there on his platform, it most
certainly will be found elsewhere.

Say what? The implementations more certainly are proprietary, and are
often not distributed. Where did you get the idea that it was otherwise?
I said proprietary + hidden as in MFC/ATL etc where the source is
tucked away in object files. The source for toupper as well as the rest
of the C++ language might certainly be copyrighted, but hidden it is
most definitely not. Unless you happen to come accross some
implementation i've not seen.

Dec 11 '06 #8
Salt_Peter wrote:
>
Default User wrote:
Salt_Peter wrote:
>
Default User wrote:
Salt_Peter wrote:

>
Ja********@gmail.com wrote:
I am learning C++, so please be kind. Is there anywhere
that I can view the source code for the toUpper function?
Thanks.
>
Never heard of toUpper.
>
Take a look at ctype.h for a C answer and note that
toupper(...) becomes std::toupper(...) according to <cctype>.

How likely is that to give the OP the source code for the
function?

>
It should, it does here.
It does? Where is "here"? I've not seen source code for library
functions in headers in any implementation I've ever used.
And since C++ nor C are proprietary, hidden
implementations, if its not found there on his platform, it most
certainly will be found elsewhere.
Say what? The implementations more certainly are proprietary, and
are often not distributed. Where did you get the idea that it was
otherwise?

I said proprietary + hidden as in MFC/ATL etc where the source is
tucked away in object files. The source for toupper as well as the
rest of the C++ language might certainly be copyrighted, but hidden
it is most definitely not. Unless you happen to come accross some
implementation i've not seen.

Well, I use Visual C++, and I don't believe they provide the
implementation. Libraries are the usual method. Some do provide the
source files, which allows the implementation to be built, but it's
certainly not required (and not typically found in headers anyway).

Brian
Dec 11 '06 #9

Default User wrote:
Well, I use Visual C++, and I don't believe they provide the
implementation. Libraries are the usual method. Some do provide the
source files, which allows the implementation to be built, but it's
certainly not required (and not typically found in headers anyway).
But you can always get it from an open source implementation and since
toupper is pretty trivial and has a fairly limited set of reasonable
implementations it should be pretty close to whatever closed source
version you're using.

Dec 11 '06 #10
Noah Roberts wrote:
>
Default User wrote:
Well, I use Visual C++, and I don't believe they provide the
implementation. Libraries are the usual method. Some do provide the
source files, which allows the implementation to be built, but it's
certainly not required (and not typically found in headers anyway).

But you can always get it from an open source implementation and since
toupper is pretty trivial and has a fairly limited set of reasonable
implementations it should be pretty close to whatever closed source
version you're using.
Yes, which is what I recommended in the first place. Actually, a search
on the drive holding VC++ finds a TOUPPER.C file, which says:

*Purpose:
* Defines function versions of _toupper() and toupper().
So looks like it does provide at least some source.


Brian
Dec 11 '06 #11

Default User wrote:
Noah Roberts wrote:

Default User wrote:
Well, I use Visual C++, and I don't believe they provide the
implementation. Libraries are the usual method. Some do provide the
source files, which allows the implementation to be built, but it's
certainly not required (and not typically found in headers anyway).
But you can always get it from an open source implementation and since
toupper is pretty trivial and has a fairly limited set of reasonable
implementations it should be pretty close to whatever closed source
version you're using.

Yes, which is what I recommended in the first place. Actually, a search
on the drive holding VC++ finds a TOUPPER.C file, which says:

*Purpose:
* Defines function versions of _toupper() and toupper().
So looks like it does provide at least some source.
I think you get all the source with VS. You need it to view source
when debugging or you just end up stepping off the assembler cliff.

Dec 11 '06 #12
Noah Roberts wrote:
>
Default User wrote:
Noah Roberts wrote:
>
Default User wrote:
>
Well, I use Visual C++, and I don't believe they provide the
implementation. Libraries are the usual method. Some do provide
the source files, which allows the implementation to be built,
but it's certainly not required (and not typically found in
headers anyway).
>
But you can always get it from an open source implementation and
since toupper is pretty trivial and has a fairly limited set of
reasonable implementations it should be pretty close to whatever
closed source version you're using.
Yes, which is what I recommended in the first place. Actually, a
search on the drive holding VC++ finds a TOUPPER.C file, which says:

*Purpose:
* Defines function versions of _toupper() and toupper().
So looks like it does provide at least some source.

I think you get all the source with VS. You need it to view source
when debugging or you just end up stepping off the assembler cliff.
Yep, that's exactly what it does.

Never mind.


Brian
Dec 11 '06 #13
Ja********@gmail.com wrote:
I am learning C++, so please be kind. Is there anywhere that I can
view the source code for the toUpper function? Thanks.
Well, here is one *suggestion* which *might* work for you, if you use
ASCII as pointed out by "Default User" <de***********@yahoo.com>:

int toupper(int c)
{
return (c-32*(c>='a' && c<='z'));
}
Sincerely,

Peter Jansson
http://www.p-jansson.com/
http://www.jansson.net/
Dec 12 '06 #14

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

Similar topics

7
by: Duane | last post by:
Aside from the pitfalls of using this function, according to the standard, what is the correct way to call it? #include <string> #include <locale> // seems to work with BCC5.6/STLPort...
2
by: John Beschler | last post by:
I have a c# function that runs fine in VS.Net when in debug mode; however, when I switch to Relase mode or compile the app, the function fails with "object refernce not set". Here is the whole...
18
by: didgerman | last post by:
Chaps, I need to properly format the case of a struct. Can I just hit it with tolower, and then 'while (string ==' ') pos++; string=toupper(string); to add in the higher case for the start of...
3
by: gelbeiche | last post by:
I have a question regarding the following small C program. #include <locale.h> int main() { char* loc = 0; char before,after; int i;
48
by: Frederick Gotham | last post by:
The "toupper" function takes an int as an argument. That's not too irrational given that a character literal is of type "int" in C. (Although why it isn't of type "char" escapes me... ) The...
2
by: gdarian216 | last post by:
I am tring to write a program that takes a input char and if it is lower case changes it to capital, then outputs the value. If it is already capital it just outputs the value. this is what i was...
4
by: sandy | last post by:
I am trying to upper case a string, so I have this method: string FileSystem::toupper(string S) { for (int i=0; i<S.length(); ++i) { S=toupper(S); } return S;
16
by: gaga | last post by:
my function should accept a pointer to a string as its argument. and it should convert each charater to an uppercase letter. I know what i need to do, its just my syntax is all out of whack. ...
33
by: Adeel Hasan Akbari | last post by:
Hi! I'm new to this field. Actually i'm a new programmer. And i've never worked in C. It is my humble request to you to provide me with the source code for Spaceball (the game in which there's...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.