Thread: number to LPCSTR!!!!!!?

  1. #1
    Unregisterred
    Guest

    number to LPCSTR!!!!!!?

    I apologise if this is a really common question but I searched the board,google,various faqs etc, and ended up with nothing!!(me=frustrated).
    So can anyone point me to a function that converts a number to an LPCSTR? I looked in the winapi.hlp and searched msdn and there seems to be no winapi-function that does this?

    itoa doesn't like it either (errrorr i get!!!!)

    pleeeease help!!!
    /unregisteredd

  2. #2
    Unregisterred
    Guest
    once again I apologise since this thead was intended to go to the windows-section
    sorry,
    but maybe someone here can help me aswell
    /unregisterred

  3. #3
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    I suppose sprintf() is what you are after.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  4. #4
    My Avatar says: "Stay in School"

    Rocco is the Boy!
    "SHUT YOUR LIPS..."

  5. #5
    I didn't see that you already searched MSDN...

    I don't know the windows functions that would do this but I think the C++ STD has stuff for this.

    try <cctype.h> or something similar, forget name, it should have conversion functions.

    or there is also dynamic_cast<> and static_cast<> functions in the C++ STD LIB.
    My Avatar says: "Stay in School"

    Rocco is the Boy!
    "SHUT YOUR LIPS..."

  6. #6
    Registered User
    Join Date
    Mar 2002
    Posts
    1,595
    LPCSTR is a type def for a null terminated char array. Therefore, search the board for the options of going from int to null terminated char array--also known as C string---- and the cast to LPCSTR. Two options are sprint(), itoa() (admittedly a nonstandard function, but very convenient). I think the third option is a stringstream, but you'd have to do some searching to confirm that.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help with this compiler error
    By Evangeline in forum C Programming
    Replies: 7
    Last Post: 04-05-2008, 09:27 AM
  2. Calculating next prime number
    By anilemon in forum C Programming
    Replies: 8
    Last Post: 04-17-2006, 10:38 AM
  3. Prime number program problem
    By Guti14 in forum C Programming
    Replies: 11
    Last Post: 08-06-2004, 04:25 AM
  4. parsing a number
    By juancardenas in forum C Programming
    Replies: 1
    Last Post: 02-19-2003, 01:10 PM
  5. Random Number problem in number guessing game...
    By -leech- in forum Windows Programming
    Replies: 8
    Last Post: 01-15-2002, 05:00 PM