how to convert char to int?

  • Dear All,

    I am looking for a source code that lets me convert
    the type char to the int type.

    Thanks for your feedback.

    Best regards,
    Amine

          _____________________________________________________________________________
    Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail
  • On 19 Nov 2007, at 09:56, amine ahmadi wrote:

    > I am looking for a source code that lets me convert the type char to
    > the int type.

    Amine, please go and buy yourself a book on learning C.  Nobody is
    going to answer questions this fundamental here, otherwise we'll be
    writing your entire program for you before very long.  (And that's
    ignoring the fact that this is a C question and has nothing to do with
    Cocoa.)

    This book consistently gets good write-ups from people on this list:

      <http://www.amazon.com/Programming-C-3rd-Developers-Library/dp/0672326663>

    and there's also an Objective-C version:

      <http://www.amazon.com/Programming-Objective-C-Stephen-Kochan/dp/0672325861>

    which I've heard less about.  I'll leave it up to someone who actually
    owns/has actually read the books to comment on the relative merits of
    the two.

    If you're studying at a school or university, and you're finding it
    confusing, you might also consider asking your tutors.  If you're
    working for a company, they should have other developers who can help
    you if you get stuck.  The people on this list are happy to answer
    questions about Cocoa, and will try to be helpful with other questions
    too on many occasions, but we will expect you to make some effort to
    answer them yourself first; remember, we're all volunteers and many of
    us have only a limited amount of spare time to devote to answering
    questions on the list.

    Kind regards,

    Alastair.

    --
    http://alastairs-place.net
  • char c = 'a';
    int ikl = (int)c;
    NSLog(@"%d",ikl);

    Am Nov 19, 2007 um 10:56 AM schrieb amine ahmadi:

    > Dear All,
    >
    > I am looking for a source code that lets me convert
    > the type char to the int type.
    >
    > Thanks for your feedback.
    >
    > Best regards,
    > Amine
  • On Nov 19, 2007, at 1:56 AM, amine ahmadi wrote:

    > Dear All,
    >
    > I am looking for a source code that lets me convert
    > the type char to the int type.

    I encourage you to find a book on the C programming language.

    char foo;
    int bar;
    foo = 'A';
    bar = (int) foo;

    ...or do you want to convert a character string into a number? If so
    look at -[NSString stringWithFormat:], -[NSScanner scanInt:] or one of
    the low level C lib functions.

    -Shawn
previous month november 2007 next month
MTWTFSS
      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    
Go to today