Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > ulltostr

Reply
Thread Tools

ulltostr

 
 
Mike
Guest
Posts: n/a
 
      11-18-2005
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.
 
Reply With Quote
 
 
 
 
Jordan Abel
Guest
Posts: n/a
 
      11-18-2005
On 2005-11-18, Mike <(E-Mail Removed)> 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.
 
Reply With Quote
 
 
 
 
David Resnick
Guest
Posts: n/a
 
      11-18-2005

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

 
Reply With Quote
 
Richard Heathfield
Guest
Posts: n/a
 
      11-18-2005
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)
 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      11-18-2005
Richard Heathfield <(E-Mail Removed)> 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.velocityreviews.com/forums/(E-Mail Removed) <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.
 
Reply With Quote
 
Randy Howard
Guest
Posts: n/a
 
      11-19-2005
Keith Thompson wrote
(in article <(E-Mail Removed)>):

> Richard Heathfield <(E-Mail Removed)> 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





 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments