[comp.lang.c] PRINTUSING function for C?

root@fincomp.UUCP (Superuser) (07/18/90)

Has anyone ever implemented BASIC's PRINTUSING feature in C?

I have a situation where some basic software types forms with a statement
like:

  call typereal(hp, vp, "$###,###,##.##", realvar);

where hp and vp are x,y coordinates where the output is to be printed,
realvar is a double precision real variable, and that mess in the 
middle is a format specifier used by BASIC's PRINTUSING statement.
This statement would cause the value of realvar to be printed in a
dollar and cents format with commas and a floating dollar sign.
If I had a way to handle the printusing statement in C then I could
re-use a bunch of existing BASIC code with just a touch of editing.

Post or email - all help appreciated!
My apologies for speaking the word BASIC in this group!  

Aren't you glad you use C?  Don't you wish everybody did?


uucp: tiamat!mjbtn!fincomp!neal | You code 16K, and what do you get?
internet: fincomp.jobsoft.com   | Another day older and deeper in debt!
Neal McClain                    | St. Peter don't ya call me 'cause I can't go;
Murfreesboro, TN                | I owe my soul to the UNIX bookstore!

malloy@nprdc.arpa (Sean Malloy) (07/21/90)

In article <37@fincomp.UUCP> root@fincomp.UUCP (Superuser) writes:
|I have a situation where some basic software types forms with a statement
|like:

|  call typereal(hp, vp, "$###,###,##.##", realvar);

|where hp and vp are x,y coordinates where the output is to be printed,
|realvar is a double precision real variable, and that mess in the 
|middle is a format specifier used by BASIC's PRINTUSING statement.
|This statement would cause the value of realvar to be printed in a
|dollar and cents format with commas and a floating dollar sign.
|If I had a way to handle the printusing statement in C then I could
|re-use a bunch of existing BASIC code with just a touch of editing.

The latest issue of Dr. Dobb's Journal has an article on writing
routines for handling formatted output like this; I suggest that you
look there first.


                                               | "The three most dangerous
 Sean Malloy                                   | things in the world are a
 Navy Personnel Research & Development Center  | programmer with a soldering
 San Diego, CA 92152-6800                      | iron, a hardware type with a
 malloy@nprdc.navy.mil                         | program patch, and a user
                                               | with an idea."