Re: C strings?
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.