How Do I Print to Printer With Casio VX-4 C?
|
08-04-2022, 10:15 PM
Post: #1
|
|||
|
|||
How Do I Print to Printer With Casio VX-4 C?
I have a Casio VX-4 and the interface box with a Casio printer. I can print to the printer from BASIC using LPRINT but in C, I have to use stdprn somehow. The C instructions in the only manual I have are mostly in Japanese and online translators aren't much help. There is no fopen in the VX-4 version of C so I can't open the printer for output. Here's what I've tried:
FILE *stdprn; fprintf(stdprn,"%d",3.14159); This doesn't work. Tom L Cui bono? |
|||
08-05-2022, 03:21 AM
Post: #2
|
|||
|
|||
RE: How Do I Print to Printer With Casio VX-4 C?
I don't have a VX-4 but from a C point of view, %d prints and integer not a float so looks a bit suspicious, you'll maybe get junk, or maybe Casio have a different %d.
Also, stdprn should be defined in stdio.h so you have created a local variable that hides the real stdprn when you define stdprn in that code. try taking out the FILE *stprn; line and add in #include <stdio.h> if it's not already there. |
|||
08-05-2022, 07:45 AM
(This post was last modified: 08-07-2022 10:35 AM by toml_12953.)
Post: #3
|
|||
|
|||
RE: How Do I Print to Printer With Casio VX-4 C?
(08-05-2022 03:21 AM)blackjetrock Wrote: I don't have a VX-4 but from a C point of view, %d prints and integer not a float so looks a bit suspicious, you'll maybe get junk, or maybe Casio have a different %d. Thanks for the reply! Casio C can't include headers like stdio.h. I did manage to print, however. Here's the program as it runs in Casio VX-4 C. It's an adaptation of the program found on page 5-5 of Learning to Program in C by Thomas Plum: Code: /* powdem - demonstrate power function 2 to the power 0 equals 1 2 to the power 1 equals 2 : : 2 to the power 9 equals 512 Some changes I had to make: 1) Casio C needs to define functions that come after main() so I had to add double pw(); in main() 2) User-defined functions can't duplicate predefined functions so I had to rename pow() to another name. I chose pw() 3) The statement extern FILE *stdprn had to be added to use a file pointer to the printer. 4) In Casio C, exit() can't take a parameter so the parameter in the book had to be removed. Tom L Cui bono? |
|||
10-07-2022, 02:51 PM
Post: #4
|
|||
|
|||
RE: How Do I Print to Printer With Casio VX-4 C?
Nice to see someone is still using one of these - I have one being shipped from Japan. The idea is to scan and then translate the documentation so we finally have an English manual for this very special Casio offering!
Regards, Mark. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)