• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: C strings?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C strings?


  • Subject: Re: C strings?
  • From: eHolley <email@hidden>
  • Date: Mon, 23 Feb 2004 13:49:09 -0700

when i create a C string like so is A still a or is a numerical rep of
a? what exactly do i have when i create the string?

The code

char code[4];

creates an array of 4 chars (stored as ints).

Setting one of the array elements to a character literal assigns the ASCII integer, not the actual letter.

code[0] = 'A';

is the same as

code[0] = 65;


i ask this because
i'm creating a basic reg gen and i would like to make the same system
in php so i can automate the payment / registration process but i can
recreate the same results in php i think it has to do with the way i'm
working with the characters?

// in php
$code6 = $payer_email{7};
$code7 = $payer_email{3};
$code8 = $payer_email{2};
$code9 = $payer_email{0};

// in cocoa
char code[4];

code[0] = 'A';
code[1] = 'X';
code[2] = '1';
code[3] = 0;

the cocoa ones are just alpha variables, does anyone know what i have
to convert them to to make them the same as they are in cocoa?


Cocoa uses NSString for its string functionality. Do you mean that you want some way of converting C strings into NSStrings?


-Erik
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >C strings? (From: email@hidden)

  • Prev by Date: Re: C strings?
  • Next by Date: Re: New to Objective-C/Cocoa Programming
  • Previous by thread: Re: C strings?
  • Next by thread: Validating in a formatter
  • Index(es):
    • Date
    • Thread