Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > help needed on coversin of an char array to an integer

Reply
Thread Tools

help needed on coversin of an char array to an integer

 
 
Flash Gordon
Guest
Posts: n/a
 
      02-22-2008
Old Wolf wrote, On 22/02/08 12:55:
> On Feb 21, 10:43 pm, (E-Mail Removed) wrote:
>> What makes you think 'A'..'F' (and lowercase) are indeed sequential?

>
> Because they were/are sequential on every single
> system that ever had a C compiler?


Are you claiming there were no C compilers for any of the hardware that
uses EBCDIC?
http://groups.google.com/group/comp....a1b727af34b029
--
Flash Gordon
 
Reply With Quote
 
 
 
 
Willem
Guest
Posts: n/a
 
      02-22-2008
Flash wrote:
) Are you claiming there were no C compilers for any of the hardware that
) uses EBCDIC?
) http://groups.google.com/group/comp....a1b727af34b029

On EBCDIC, the characters 'A'..'F' and 'a'..'f' ARE consecutive.

To be more precise: The letters are in sequence, it's just that there
are gaps between i and j, and also between r and s.

SaSW, Willem
--
Disclaimer: I am in no way responsible for any of the statements
made in the above text. For all I know I might be
drugged or something..
No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT
 
Reply With Quote
 
 
 
 
vippstar@gmail.com
Guest
Posts: n/a
 
      02-22-2008
On Feb 22, 3:47 pm, Flash Gordon <(E-Mail Removed)> wrote:
> Old Wolf wrote, On 22/02/08 12:55:
>
> > On Feb 21, 10:43 pm, (E-Mail Removed) wrote:
> >> What makes you think 'A'..'F' (and lowercase) are indeed sequential?

>
> > Because they were/are sequential on every single
> > system that ever had a C compiler?

>
> Are you claiming there were no C compilers for any of the hardware that
> uses EBCDIC?

In EBCDIC, 'a'..'f' and 'A'..'F' are sequential.
Even if there is no charset, the standard does not guarantee it, and I
believe that's all you need to know.
 
Reply With Quote
 
Ben Bacarisse
Guest
Posts: n/a
 
      02-22-2008
Flash Gordon <(E-Mail Removed)> writes:

> Old Wolf wrote, On 22/02/08 12:55:
>> On Feb 21, 10:43 pm, (E-Mail Removed) wrote:
>>> What makes you think 'A'..'F' (and lowercase) are indeed sequential?

>>
>> Because they were/are sequential on every single
>> system that ever had a C compiler?

>
> Are you claiming there were no C compilers for any of the hardware
> that uses EBCDIC?
> http://groups.google.com/group/comp....a1b727af34b029


EBCDIC had 'a' to 'f' and 'A' to 'F' sequential, as that post states.
I don't want to advocate the assumption (since it is not hard to
avoid) but I know of no encoding in which it would not be true.

BTW, I think there *should* be an 'int toxvalue(int c);' in standard C
since the implementation can do a better job of this simple conversion
than any portable code.

--
Ben.
 
Reply With Quote
 
Richard Tobin
Guest
Posts: n/a
 
      02-22-2008
In article <(E-Mail Removed)-gordon.me.uk>,
Flash Gordon <(E-Mail Removed)> wrote:

>>> What makes you think 'A'..'F' (and lowercase) are indeed sequential?


>> Because they were/are sequential on every single
>> system that ever had a C compiler?


>Are you claiming there were no C compilers for any of the hardware that
>uses EBCDIC?


The gaps in EBCDIC are between I and J, and R and S.

-- Richard
--
:wq
 
Reply With Quote
 
CBFalconer
Guest
Posts: n/a
 
      02-22-2008
Richard Heathfield wrote:
> MisterE said:
>
>> I don't bother assuming he is one of 0.0000000000000000001% of
>> people who don't use ASCII character set for raw chars in c.

>
> If we assume everyone on the planet - around 6600000000 people -
> uses a computer, then 0.0000000000000000001% of this would be
> 0.0000000000066 people. Effectively, you're claiming that at
> most one person on the planet uses a non-ASCII system.
>
> You are mistaken.


Besides which 'a'..'f' and 'A'..'F' are part of the basic character
set, and required for all C systems. Their sequentiality is
unspecified.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.



--
Posted via a free Usenet account from http://www.teranews.com

 
Reply With Quote
 
CBFalconer
Guest
Posts: n/a
 
      02-22-2008
Old Wolf wrote:
> (E-Mail Removed) wrote:
>
>> What makes you think 'A'..'F' (and lowercase) are indeed sequential?

>
> Because they were/are sequential on every single
> system that ever had a C compiler?


Oh my. You have led a sheltered life. Read the standard.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.



--
Posted via a free Usenet account from http://www.teranews.com

 
Reply With Quote
 
CBFalconer
Guest
Posts: n/a
 
      02-22-2008
Ben Bacarisse wrote:
>

.... snip ...
>
> BTW, I think there *should* be an 'int toxvalue(int c);' in
> standard C since the implementation can do a better job of this
> simple conversion than any portable code.


There is:

int hexvalue(int c) {
static const char s = "abcdef";
return (strchr(s, c)) - &s + 10;
}

Convert it into a macro if you wish. It returns 16 for a bad c.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.



--
Posted via a free Usenet account from http://www.teranews.com

 
Reply With Quote
 
Bartc
Guest
Posts: n/a
 
      02-22-2008

"Richard Tobin" <(E-Mail Removed)> wrote in message
news:fpmor7$25da$(E-Mail Removed)...
> In article <(E-Mail Removed)-gordon.me.uk>,
> Flash Gordon <(E-Mail Removed)> wrote:
>
>>>> What makes you think 'A'..'F' (and lowercase) are indeed sequential?

>
>>> Because they were/are sequential on every single
>>> system that ever had a C compiler?

>
>>Are you claiming there were no C compilers for any of the hardware that
>>uses EBCDIC?

>
> The gaps in EBCDIC are between I and J, and R and S.


Why would whoever put together EBCDIC encoding, put big holes in it like
that?

It would be more understandable if it was accented versions of some
characters, but apparently it's a couple of punctuation characters.

Whoever created it should have been fired.

Even a child would at least have come up with 1 to 26.

--
Bart


 
Reply With Quote
 
CBFalconer
Guest
Posts: n/a
 
      02-22-2008
Bartc wrote:
> "Richard Tobin" <(E-Mail Removed)> wrote:
>

.... snip ...
>>
>> The gaps in EBCDIC are between I and J, and R and S.

>
> Why would whoever put together EBCDIC encoding, put big holes in
> it like that? It would be more understandable if it was accented
> versions of some characters, but apparently it's a couple of
> punctuation characters. Whoever created it should have been fired.
>
> Even a child would at least have come up with 1 to 26.


It made the interface with existing punch card systems easy. You
should ask questions, rather than jumping to illogical conclusions.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.



--
Posted via a free Usenet account from http://www.teranews.com

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
length of 2D Array >> char **myString= (char **) malloc (sizeof (char *)); davidb C++ 0 09-01-2006 03:22 PM
(const char *cp) and (char *p) are consistent type, (const char **cpp) and (char **pp) are not consistent lovecreatesbeauty C Programming 1 05-09-2006 08:01 AM
Problem- strcat with char and char indexed from char array aldonnelley@gmail.com C++ 3 04-20-2006 07:32 AM
/usr/bin/ld: ../../dist/lib/libjsdombase_s.a(BlockGrouper.o)(.text+0x98): unresolvable relocation against symbol `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostre silverburgh.meryl@gmail.com C++ 3 03-09-2006 12:14 AM
char->integer, integer->char commands christophergraber@gmail.com Perl Misc 5 11-22-2005 07:13 AM



Advertisments