[comp.os.msdos.apps] DBASE refuses to send CHR

vlsi3@erato.cs.kun.nl (vlsi cursus) (10/15/90)

Hi readers,

I'm writing a small database program using Dbase, which uses the printer.
Therefore I need to send the null character, because it is part of a
printer control code. It is used in the following context:
SET PRINT ON
?? ....+CHR(0)+..
|
SET PRINT OFF

The problem is, the printer doesn't receive the null character (I checked
it with a hex-dump). Does anyone know what how to do it in another way??

BTW: it is dbase 3+.

Thanks in advance.

					Greetings,
					John Graat
					University of Nijmegen
					The Netherlands.
					email: ose21@sci.kun.nl

Please don't reply to this account (vlsi3@cs.kun.nl) because it can be
closed every day now. The other one mentioned above will be in use at
least until X-mas! Thanks.

av@kielo.uta.fi (Arto V. Viitanen) (10/16/90)

>>>>> On 15 Oct 90 14:14:37 GMT, vlsi3@erato.cs.kun.nl (vlsi cursus) said:

vlsi> Hi readers,

vlsi> I'm writing a small database program using Dbase, which uses the printer.
vlsi> Therefore I need to send the null character, because it is part of a
vlsi> printer control code. It is used in the following context:
vlsi> SET PRINT ON
vlsi> ?? ....+CHR(0)+..
vlsi> |
vlsi> SET PRINT OFF

I am not sure about your printer, but at least those I know can use 48
(ASCII code for 0) as 0 just because some programs don't know how to send
code 0.

If you are sending graphics, this does not help ...

--
Arto V. Viitanen				         email: av@kielo.uta.fi
University Of Tampere,				   	    av@ohdake.cs.uta.fi
Finland

belt@freyr.pttrnl.nl (Evert van de Belt) (10/16/90)

Beste John,

DBASE III en ook foxbase + staan het gebruik van chr(0) niet toe
omdat ze die code intern in de databases gebruiken. Een oplossing
is om Clipper te gaan gebruiken. Een andere oplossing is om een 
programmeertaal te pakken (bijv. TurboPascal) en daarin een programmatje
(met twee aa's) te schrijven dat een aantal waardes meekrijgt als 
parameters, (C kan dit makkelijk) en dan die waarden naar de printer stuurt.
Dan hoef je aan dat programma niet chr(0) mee te geven, maar gewoon 0.
Je voert zo'n programma uit met RUN <prog> <parameters>.

Succes.

Evert van de Belt
E_vdBelt@pttrnl.nl
 

fisher@sc2a.unige.ch (Markus Fischer) (10/18/90)

In article <2292@wn1.sci.kun.nl>, vlsi3@erato.cs.kun.nl (vlsi cursus) writes:
> Hi readers,
> 
> I'm writing a small database program using Dbase, which uses the printer.
> Therefore I need to send the null character, because it is part of a
> printer control code. It is used in the following context:
> SET PRINT ON
> ?? ....+CHR(0)+..
> |
> SET PRINT OFF
> 
> The problem is, the printer doesn't receive the null character (I checked
> it with a hex-dump). Does anyone know what how to do it in another way??
> 
> BTW: it is dbase 3+.
> 

I just tried it myself, and it really doesn't work!

One way around this would be to use an external program to send the null
character, or even better, any control code to the printer.  Example (TC):

#include <stdio.h>
main()
{
   FILE *prn = fopen("PRN","wb");  /* open DOS' PRN */
   fprintf(prn, "\0");             /* send the code */
}

something more technical like

#include <io.h>
main()
{
   _write(4, "\0", 1);   /* (binary) write one byte to file handle 4 (prn?) */
}

works also.

In dBASE, you call the external program with
 run <prog> [parameters]

If your dBASE program uses the external very often, you could try to convert
it to a "binary" (a *.BIN produced by EXE2BIN, same format as a *.COM), and
use it as:
 load <prog>
 call <prog> [with <param>]
but to tell the truth, I couldn't get it to work, even with the mose elementary
program like "printf("Hello dBASE!\n")".  I guess I'm missing some point, and
as I don't have any technical docs...

Sorry for the sketchy information, hope it helps some.

Markus Fischer, Dpt. of Anthropology.

rreiner@yunexus.YorkU.CA (Richard Reiner) (10/20/90)

fisher@sc2a.unige.ch (Markus Fischer) writes:
>In article <2292@wn1.sci.kun.nl>, vlsi3@erato.cs.kun.nl (vlsi cursus) writes:
>> SET PRINT ON
>> ?? ....+CHR(0)+..
>> SET PRINT OFF
>One way around this would be to use an external program to send the null
>character, or even better, any control code to the printer.  Example (TC):

If you're really using dB3, you may be stuck with this solution; if
you're using Clipper, however, you can just write a little C routine
which dumps data to the printer and link it in.  No need for a spawn
(or RUN, in dB3-speak) every time you want to initialize the printer.

ted@polyof.poly.edu (A1 ted kapela (staff) ) (10/24/90)

In article <2292@wn1.sci.kun.nl>, vlsi3@erato.cs.kun.nl (vlsi cursus) writes:
> Hi readers,
> 
> I'm writing a small database program using Dbase, which uses the printer.
> Therefore I need to send the null character, because it is part of a
> printer control code. It is used in the following context:
> SET PRINT ON
> ?? ....+CHR(0)+..
> |
> SET PRINT OFF
> 
> The problem is, the printer doesn't receive the null character (I checked
> it with a hex-dump). Does anyone know what how to do it in another way??
> 
> BTW: it is dbase 3+.

I too had the same problem.  I found a solution that may or may not
work.  (If you have an epson or compatible, this should work)

When I had the problem, I checked the printer manual to see if there
was anything else I could send instead of a CHR(0).  Indeed 
There WAS!.  The printer would accept CHR(128) also!  This DOES
work in dBase III+.

Set Print ON
?? . . . +CHR(128)+. . .

instead of

Set Print ON
?? . . . +CHR(0)+. . .

Hope this helps.


-- 
...............................................................................
    Theodore S. Kapela                  (516) 755-4299 [Voice, Days]
    ted@polyof.poly.edu	                (516) 473-7746 [FAX]
           "Another brilliant mind corrupted by education"

paulg@bhpmrl.oz.au (Paul Gallagher) (10/29/90)

This brings back memories! I can only recall some sketchy details
but here goes:

?/?? has problems with null char for some reason related to dBase's
output string handling (can't for the life of me remember the
details!).

??? bypasses the installed printer driver and allows you to send
the null character, but maybe this command only appeared in
dbase IV? If so then this message hasn't been much use, has it!

Regards,
Paul

     /\/\       Paul Gallagher, PC Support Officer,
    / / /\      Computer Systems Group,
   / / /  \     BHP Melbourne Research Laboratories
  / / / /\ \    245 Wellington Rd Mulgrave Vic 3170 AUSTRALIA
  \ \/ / / /    Phone : +61-3-560-7066,  Fax : +61-3-561-6709
   \  / / /     ACSnet  :  paulg@bhpmrl.OZ.AU        
    \/\/\/