Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > about string and character

Reply
Thread Tools

about string and character

 
 
CBFalconer
Guest
Posts: n/a
 
      11-25-2007
Harald van D?k wrote:
> Harald van Dijk wrote:
>> santosh wrote:
>>
>>> It was fine when Harald started posting to this group, but for a
>>> few months now, his name has not been displayed properly.

>>
>> Apparently KNode encoded my name in utf-8, but Pan encodes it in
>> iso-2022-kr. I'll check if there's an option to change that.

>
> Does it display better like this?


Yes, except for the middle character in the name "D?k". That is
still a bind for any return e-mail addresses.

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



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

 
Reply With Quote
 
 
 
 
Ben Bacarisse
Guest
Posts: n/a
 
      11-25-2007
Harald van Dijk <> writes:

> On Sun, 25 Nov 2007 12:32:13 +0000, Harald van Dijk wrote:

<snip>
>> Apparently KNode encoded my name in utf-8, but Pan encodes it in
>> iso-2022-kr. I'll check if there's an option to change that.

>
> Does it display better like this?


Just a data point. Gnus displays both.

--
Ben.
 
Reply With Quote
 
 
 
 
Barry Schwarz
Guest
Posts: n/a
 
      11-25-2007
On Sat, 24 Nov 2007 15:28:32 +0530, santosh <>
wrote:

>In article
><bffb8ed3-e648-424a-a49f->,
> <> wrote on Saturday 24 Nov 2007 2:57
>pm:
>
>> what is the difference between a single character and a string
>> consisting only one character

>
>Try this program:
>
>#include <stdio.h>
>
>int main(void) {
> char c0 = '0';
> char c1[] = "0";
>
> printf("Size of c0 is %u\nSize of c1 is %u\n", sizeof c0, sizeof c1);


Since size_t could be different than unsigned int, you should probably
the cast the second and third arguments to match the format
specification.

> return 0;
>}
>



Remove del for email
 
Reply With Quote
 
Barry Schwarz
Guest
Posts: n/a
 
      11-25-2007
On Sat, 24 Nov 2007 15:56:07 +0000 (UTC),
(Kenny McCormack) wrote:

>In article <a3f33b3f-bb91-4dff-b2ea->,
>lovecreatesbea...@gmail.com <> wrote:


snip

>>This string "0" consists of two characters. The only string that
>>consists of a single char is "".

>
>strlen() and common sense say otherwise. You are confusing how big
>something is with how much space it takes to store it. They are rarely
>the same thing, and the later is usually greater than the former.


And you are refusing to accept the definition in the standard. From
para 7.1.1-1: "A string is a contiguous sequence of characters
terminated by and including the first null character."


Remove del for email
 
Reply With Quote
 
Philip Potter
Guest
Posts: n/a
 
      11-25-2007
Harald van Dijk wrote:
> On Sun, 25 Nov 2007 12:32:13 +0000, Harald van Dijk wrote:
>> On Sun, 25 Nov 2007 14:47:18 +0530, santosh wrote:
>>> It was fine when Harald started posting to this group, but for a few
>>> months now, his name has not been displayed properly.

>> Apparently KNode encoded my name in utf-8, but Pan encodes it in
>> iso-2022-kr. I'll check if there's an option to change that.

>
> Does it display better like this?


It seems Thunderbird also copes well, including not munging the
attribution line.
 
Reply With Quote
 
Richard
Guest
Posts: n/a
 
      11-25-2007
Barry Schwarz <> writes:

> On Sat, 24 Nov 2007 15:56:07 +0000 (UTC),
> (Kenny McCormack) wrote:
>
>>In article <a3f33b3f-bb91-4dff-b2ea->,
>>lovecreatesbea...@gmail.com <> wrote:

>
> snip
>
>>>This string "0" consists of two characters. The only string that
>>>consists of a single char is "".

>>
>>strlen() and common sense say otherwise. You are confusing how big
>>something is with how much space it takes to store it. They are rarely
>>the same thing, and the later is usually greater than the former.

>
> And you are refusing to accept the definition in the standard. From
> para 7.1.1-1: "A string is a contiguous sequence of characters
> terminated by and including the first null character."


And you are refusing to understand what KM said. There is a difference
between the length of a string and the space needed to store it. As is
clear from this thread and has been true since the day C was invented.

Length is analogous to "how many character do you display in the real
world" whereas "size" is "how much storage space do you need".

>
>
> Remove del for email

 
Reply With Quote
 
Default User
Guest
Posts: n/a
 
      11-25-2007
santosh wrote:

> In article <fibo1c$sk3$>, santosh
> <> wrote on Sunday 25 Nov 2007 5:28 pm:
>
> > In article <fibrpm$mco$>, Harald van D?k
> > <> wrote on Sunday 25 Nov 2007 6:32 pm:

\
> >> Does it display better like this?

> >
> > Yes. It is now displayed correctly.

>
> Oops. It was correct when I received and replied to it, but not when I
> read it back, as you can see.



Your newsreader switched the char set from UTF-8 (the original) to
Western European.



Brian
 
Reply With Quote
 
J. J. Farrell
Guest
Posts: n/a
 
      11-25-2007
Richard wrote:
> Barry Schwarz <> writes:
>
>> On Sat, 24 Nov 2007 15:56:07 +0000 (UTC),
>> (Kenny McCormack) wrote:
>>
>>> In article <a3f33b3f-bb91-4dff-b2ea->,
>>> lovecreatesbea...@gmail.com <> wrote:

>> snip
>>
>>>> This string "0" consists of two characters. The only string that
>>>> consists of a single char is "".
>>> strlen() and common sense say otherwise. You are confusing how big
>>> something is with how much space it takes to store it. They are rarely
>>> the same thing, and the later is usually greater than the former.

>> And you are refusing to accept the definition in the standard. From
>> para 7.1.1-1: "A string is a contiguous sequence of characters
>> terminated by and including the first null character."

>
> And you are refusing to understand what KM said. There is a difference
> between the length of a string and the space needed to store it. As is
> clear from this thread and has been true since the day C was invented.


And you are refusing to look at what Kenny said in context. Kenny
claimed that the statement

>>>> This string "0" consists of two characters. The only string that
>>>> consists of a single char is "".


was wrong. Kenny was incorrect, totally and absolutely, by definition.
Kenny introduced the ideas of "how big something is" and "how much space
it takes" which aren't relevant to the statement he was supposedly
correcting. A string consists of a sequence of characters up to and
including the first null character, and has done since the day C was
invented.

> Length is analogous to "how many character do you display in the real
> world" whereas "size" is "how much storage space do you need".


If that's how you choose to define them, that's fine. It's not relevant
to the question in hand though.
 
Reply With Quote
 
Richard
Guest
Posts: n/a
 
      11-25-2007
"J. J. Farrell" <> writes:

> Richard wrote:
>> Barry Schwarz <> writes:
>>
>>> On Sat, 24 Nov 2007 15:56:07 +0000 (UTC),
>>> (Kenny McCormack) wrote:
>>>
>>>> In article <a3f33b3f-bb91-4dff-b2ea->,
>>>> lovecreatesbea...@gmail.com <> wrote:
>>> snip
>>>
>>>>> This string "0" consists of two characters. The only string that
>>>>> consists of a single char is "".
>>>> strlen() and common sense say otherwise. You are confusing how big
>>>> something is with how much space it takes to store it. They are rarely
>>>> the same thing, and the later is usually greater than the former.
>>> And you are refusing to accept the definition in the standard. From
>>> para 7.1.1-1: "A string is a contiguous sequence of characters
>>> terminated by and including the first null character."

>>
>> And you are refusing to understand what KM said. There is a difference
>> between the length of a string and the space needed to store it. As is
>> clear from this thread and has been true since the day C was invented.

>
> And you are refusing to look at what Kenny said in context. Kenny
> claimed that the statement
>
>>>>> This string "0" consists of two characters. The only string that
>>>>> consists of a single char is "".

>
> was wrong. Kenny was incorrect, totally and absolutely, by


Not in the context of what he said which was that "strlen" and "common
sense" say otherwise. Not the standard.

strlen and "common sense" say that the string length of "0" is 1. The
size is 2. That is a different thing.

But we know what me mean. No point in getting in tedious language wars
here.

> definition. Kenny introduced the ideas of "how big something is" and
> "how much space it takes" which aren't relevant to the statement he
> was supposedly correcting. A string consists of a sequence of
> characters up to and including the first null character, and has done
> since the day C was invented.
>
>> Length is analogous to "how many character do you display in the real
>> world" whereas "size" is "how much storage space do you need".

>
> If that's how you choose to define them, that's fine. It's not
> relevant to the question in hand though.


Actually its totally relevant since it defines the difference between
the "length" and the "size" which were the pertinent points here.

 
Reply With Quote
 
J. J. Farrell
Guest
Posts: n/a
 
      11-26-2007
Richard wrote:
> "J. J. Farrell" <> writes:
>
>> Richard wrote:
>>> Barry Schwarz <> writes:
>>>
>>>> On Sat, 24 Nov 2007 15:56:07 +0000 (UTC),
>>>> (Kenny McCormack) wrote:
>>>>
>>>>> In article <a3f33b3f-bb91-4dff-b2ea->,
>>>>> lovecreatesbea...@gmail.com <> wrote:
>>>> snip
>>>>
>>>>>> This string "0" consists of two characters. The only string that
>>>>>> consists of a single char is "".
>>>>> strlen() and common sense say otherwise. You are confusing how big
>>>>> something is with how much space it takes to store it. They are rarely
>>>>> the same thing, and the later is usually greater than the former.
>>>> And you are refusing to accept the definition in the standard. From
>>>> para 7.1.1-1: "A string is a contiguous sequence of characters
>>>> terminated by and including the first null character."
>>> And you are refusing to understand what KM said. There is a difference
>>> between the length of a string and the space needed to store it. As is
>>> clear from this thread and has been true since the day C was invented.

>> And you are refusing to look at what Kenny said in context. Kenny
>> claimed that the statement
>>
>>>>>> This string "0" consists of two characters. The only string that
>>>>>> consists of a single char is "".

>> was wrong. Kenny was incorrect, totally and absolutely, by

>
> Not in the context of what he said which was that "strlen" and "common
> sense" say otherwise. Not the standard.
>
> strlen and "common sense" say that the string length of "0" is 1. The
> size is 2. That is a different thing.
>
> But we know what me mean. No point in getting in tedious language wars
> here.


Agreed.

>> definition. Kenny introduced the ideas of "how big something is" and
>> "how much space it takes" which aren't relevant to the statement he
>> was supposedly correcting. A string consists of a sequence of
>> characters up to and including the first null character, and has done
>> since the day C was invented.
>>
>>> Length is analogous to "how many character do you display in the real
>>> world" whereas "size" is "how much storage space do you need".

>> If that's how you choose to define them, that's fine. It's not
>> relevant to the question in hand though.

>
> Actually its totally relevant since it defines the difference between
> the "length" and the "size" which were the pertinent points here.


The pertinent points here are whether or not the string "0" consists of
two chars, and whether or not the only string that consists of a single
char is "". Those two statements are true no matter how you define size
and length. The difference between size and length isn't relevant.
 
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
Convert string with control character in caret notation to realcontrol character string. Bart Vandewoestyne C Programming 8 09-25-2012 12:41 PM
FAQ 4.31 How can I split a [character] delimited string except when inside [character]? PerlFAQ Server Perl Misc 0 01-25-2011 05:00 AM
How can I replace all occurrences of a character with another character in std string? herman C++ 5 08-30-2007 09:05 AM
8 bit character string to 16 bit character string Brand Bogard C Programming 8 05-28-2006 05:05 PM
getting the character code of a character in a string Velvet ASP .Net 9 01-19-2006 09:27 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57