• 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: A question I'm ashamed to ask
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A question I'm ashamed to ask


  • Subject: Re: A question I'm ashamed to ask
  • From: Daniel Ström <email@hidden>
  • Date: Wed, 20 Oct 2004 20:32:02 +0200

Looks to me as if you'd want to use sprintf.

char *something = malloc(as_much_space_as_you_need);
int the_value;
sprintf(something, "%x", the_value);

If you need more help, then you can use the terminal, and write "man sprintf", and press enter.
There is help for the entire standard C library.


Best regards
Daniel Strom



20 okt 2004 kl. 19.48 skrev April Gendill:

Ok. I work with plain old ansi c so little that this has escaped me. In one of my application I need to take a plain old C character array
and make it into a string but the string needs to use a conversion character.

so I basically I need
char * something = "%x", someInteger;

basically I need to convert the integer into it's hex value and place it in the string.
I can't figure out how to do this.


April.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
References: 
 >A question I'm ashamed to ask (From: April Gendill <email@hidden>)

  • Prev by Date: Re: Cocoa font question
  • Next by Date: Re: A question I'm ashamed to ask
  • Previous by thread: A question I'm ashamed to ask
  • Next by thread: Re: A question I'm ashamed to ask
  • Index(es):
    • Date
    • Thread