• 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: const char* to char*
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: const char* to char*


  • Subject: Re: const char* to char*
  • From: Nat! <email@hidden>
  • Date: Fri, 28 Nov 2003 00:09:31 +0100

Am 27.11.2003 um 23:12 schrieb Jens Bauer:

Easy..

const char *cName = [theName cString];

:)

const means you shouldn't write into it.

You can't strcpy into it, but you can strcpy from it.

On Thursday, November 27, 2003, at 10:59 PM, David Cairns wrote:

i am getting this silly warning when compiling in Xcode. The warning comes from the line

char *cName = [theName cString];

how can i work around this such that i avoid this error? would strcpy work?



const char and char are different types.
You can also avoid the warning like this:


char *s;

s = (char *) [theName cString];


it costs nothing and keeps the compiler quiet. I try to avoid going down the "const" road :)

Ciao
Nat!

I act professionally, when I get paid for it. - Unknown
_______________________________________________
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.

  • Follow-Ups:
    • Re: const char* to char*
      • From: Finlay Dobbie <email@hidden>
    • Re: const char* to char*
      • From: Alastair Houghton <email@hidden>
    • Re: const char* to char*
      • From: "Louis C. Sacha" <email@hidden>
References: 
 >Re: const char* to char* (From: Jens Bauer <email@hidden>)

  • Prev by Date: Re: const char* to char*
  • Next by Date: NSTableView in NSTabView(Item) update problem
  • Previous by thread: Re: const char* to char*
  • Next by thread: Re: const char* to char*
  • Index(es):
    • Date
    • Thread