[comp.sys.amiga.programmer] help

wanderer@pro-graphics.cts.com (Tim Weiss) (03/10/91)

  Ever scince I installed ARP 1.3 I can't RUN anything to NIL: from AShell.
It appears to work - I don't get [shell 3] after the command but endcli
doesn't work untill the program thet was run is terminated. (Same problem
with ARun.) I'd like to stress that RUN >NIL: does work for regular
AmigaDOS. While I'm on the subject, what is CMP ? Some copy command that
docs do not cover ? Maybee? 
 
                            Thanks anybody/everybody
-- Tim Weiss

 Pro-Graphics BBS  908/469-0049  "It's better than a sharp stick in the eye!"

Internet: wanderer@pro-graphics.cts.com        | PcPursuitable @ NJNBR
    UUCP: crash!pro-graphics!wanderer          | Starlinkable      
    ARPA: crash!pro-graphics!wanderer@nosc.mil | 24hrs/day, 7 days/week

jms@vanth.UUCP (Jim Shaffer) (03/12/91)

In article <7918@crash.cts.com> wanderer@pro-graphics.cts.com (Tim Weiss) writes:
>
> While I'm on the subject, what is CMP ? Some copy command that
>docs do not cover ? Maybee?

CMP is a CoMPare program.

(Hee hee!  I just tried it and I see where you're coming from!  The command
template DOES look like a copy program!  I don't believe it!)

--
*  From the disk of:  | jms@vanth.uucp		     | "There's UFOs over New
Jim Shaffer, Jr.      | amix.commodore.com!vanth!jms | York, and I ain't too
37 Brook Street       | uunet!cbmvax!amix!vanth!jms  | surprised."
Montgomery, PA 17752  | 72750.2335@compuserve.com    |	    (John Lennon)

Charlie_Gibbs@mindlink.bc.ca (Charlie Gibbs) (05/17/91)

In article <1991May17.073147.737@crash.cts.com> neil@pnet01.cts.com
(Neil Coito) writes:

>I'm using Lattice 5.10 and need help converting a ULONG variable to a string.

How about sprintf?  It'll work with longs, and you could cast your
ULONG to long; I doubt you'll have over 2 gigabytes free.  :-)

    ULONG foo;
    char bar[10];

    sprintf (bar, "%ld", (long) foo);

Charlie_Gibbs@mindlink.UUCP
"I'm cursed with hair from HELL!"  -- Night Court

neil@pnet01.cts.com (Neil Coito) (05/17/91)

I'm using Lattice 5.10 and need help converting a ULONG variable to a string. 
I'm trying to grab the amount of free fast mem and send it to the Text()
function.  Well, the Text() function wants the second variable to be a string,
which is what is supposed to be printed, but I want to send it the amount of
free memory that I just checked.  All I can get it to do is print some funky
characters different each time.  In the Lattice manual there are conversions
for EVERYTHING ON THIS DAMN PLANET BUT NOTHING TO CONVERT AN UNLONG OR INT TO
A STRING. Please help!!!


UUCP: {hplabs!hp-sdd ucsd nosc}!crash!pnet01!neil
ARPA: crash!pnet01!neil@nosc.mil
INET: neil@pnet01.cts.com

nj@magnolia.Berkeley.EDU (Narciso Jaramillo) (05/18/91)

In article <1991May17.073147.737@crash.cts.com> neil@pnet01.cts.com (Neil Coito) writes:

>I'm using Lattice 5.10 and need help converting a ULONG variable to a string. 
>[...] In the Lattice manual there are conversions
>for EVERYTHING ON THIS DAMN PLANET BUT NOTHING TO CONVERT AN UNLONG OR INT TO
>A STRING. Please help!!!

Take a deep breath; help is on the way.  You may have noticed that
there are plenty of functions for converting strings to other things,
but no functions for converting other things to strings.  That's
because there's a general function for doing that, called ``sprintf.''
It formats its arguments just like printf, but instead of outputting
them to the console, it writes the result into a string.  So, in order
to convert a ULONG into a string:

char str[20];   /* actually, ULONGs can't be even this long */
ULONG longo;

longo = (1 << 31)  /* my goodness, that's long! */
sprintf(str, "%lu", longo);

The string str now contains the value of longo, but in ASCII format.
It's just as general as printf--anything printf can format, sprintf
can format--so you can use it to convert any type of variable to a
string.

One thing to be careful of (not just here, but generally): Be sure
that the char * you pass to it actually points to allocated memory.
In this case, I declared str as an array, so it's automatically
allocated.  If you declare it as a char *, though, you'll have to
use malloc() or AllocMem() to request memory that sprintf can use
to hold its result.


nj

ken@cbmvax.commodore.com (Ken Farinsky - CATS) (05/18/91)

In article <1991May17.073147.737@crash.cts.com> neil@pnet01.cts.com (Neil Coito) writes:
>I'm using Lattice 5.10 and need help converting a ULONG variable to a string. 

UBYTE textstr[80];
ULONG fast_mem, chip_mem;
sprintf(textstr,"%lu Fast Memory, %lu Chip Memory", fast_mem, chip_mem);
-- 
--
Ken Farinsky - CATS - (215) 431-9421 - Commodore Business Machines
uucp: ken@cbmvax.commodore.com   or  ...{uunet,rutgers}!cbmvax!ken
bix:  kfarinsky