• 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: Peter Wollschlaeger <email@hidden>
  • Date: Mon, 23 Feb 2004 21:50:06 +0100

Am 23.02.2004 um 20:47 schrieb email@hidden:

> 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? 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?
>
> Thanks


// There are several ways to generate a C-string
char *hello = "Hello";
char world[] = "World";
char buffer[80];
strcpy(buffer, world);
//convert to NSString:
NSString *ns = [NSString stringWithCString: buffer];

Cheers
Peter


> _______________________________________________
> 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.
_______________________________________________
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: [Slightly OT] The thread that wouldn't die [Was: Shareware donation collection]
  • Next by Date: Re: C strings?
  • Previous by thread: C strings?
  • Next by thread: Re: C strings?
  • Index(es):
    • Date
    • Thread