ulltostr

Discussion in 'C Programming' started by Mike, Nov 18, 2005.

  1. Mike

    Mike Guest

    Hello,
    Can someone tell me how to use the ulltostr function?
    This converts a long int to a string.
    Can someone show me a short piece of code? Thanks.
     
    Mike, Nov 18, 2005
    #1
    1. Advertising

  2. Mike

    Jordan Abel Guest

    On 2005-11-18, Mike <> wrote:
    > Hello,
    > Can someone tell me how to use the ulltostr function?
    > This converts a long int to a string.
    > Can someone show me a short piece of code? Thanks.


    My system doesn't have such a function.
     
    Jordan Abel, Nov 18, 2005
    #2
    1. Advertising

  3. Mike wrote:
    > Hello,
    > Can someone tell me how to use the ulltostr function?
    > This converts a long int to a string.
    > Can someone show me a short piece of code? Thanks.


    ulltostr is not in standard C. Perhaps you should check the manuals
    on your system (try "man ulltostr" if this is Solaris as I'd guess) or
    ask
    in a newgroup dedicated to that OS. comp.unix.solaris or
    comp.unix.programmer perhaps?

    -David
     
    David Resnick, Nov 18, 2005
    #3
  4. Mike said:

    > Hello,
    > Can someone tell me how to use the ulltostr function?
    > This converts a long int to a string.
    > Can someone show me a short piece of code? Thanks.


    There is no ulltostr function in standard C, but it's easy enough to write
    one that matches your specification.

    #include <stdio.h>

    int ulltostr(char *s, long int n)
    {
    return sprintf(s, "%ld", n);
    }

    Followups set.

    --
    Richard Heathfield
    "Usenet is a strange place" - dmr 29/7/1999
    http://www.cpax.org.uk
    email: rjh at above domain (but drop the www, obviously)
     
    Richard Heathfield, Nov 18, 2005
    #4
  5. Richard Heathfield <> writes:
    > Mike said:
    >> Can someone tell me how to use the ulltostr function?
    >> This converts a long int to a string.
    >> Can someone show me a short piece of code? Thanks.

    >
    > There is no ulltostr function in standard C, but it's easy enough to write
    > one that matches your specification.
    >
    > #include <stdio.h>
    >
    > int ulltostr(char *s, long int n)
    > {
    > return sprintf(s, "%ld", n);
    > }
    >
    > Followups set.


    <OT>But that's not consistent with the Solaris function of the same
    name.</OT>

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
    We must do something. This is something. Therefore, we must do this.
     
    Keith Thompson, Nov 18, 2005
    #5
  6. Mike

    Randy Howard Guest

    Keith Thompson wrote
    (in article <>):

    > Richard Heathfield <> writes:
    >> There is no ulltostr function in standard C, but it's easy enough to write
    >> one that matches your specification.
    >>
    >> #include <stdio.h>
    >>
    >> int ulltostr(char *s, long int n)
    >> {
    >> return sprintf(s, "%ld", n);
    >> }
    >>

    > <OT>But that's not consistent with the Solaris function of the same
    > name.</OT>


    OnTopic: But, since there is no standard function of that name,
    there is no need for conforming code posted to CLC to adhere to
    some non-standard implementation on a given platform.



    --
    Randy Howard (2reply remove FOOBAR)
    "The power of accurate observation is called cynicism by those
    who have not got it." - George Bernard Shaw
     
    Randy Howard, Nov 19, 2005
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page