Re: How can I printing non-printable chars in 4GL?
Posted in 1998
Steven L Cooper wrote: > > I am trying to print barcodes in a 4gl report to an Okidata printer. > > As I have found out, 4gl does not "play" with non-printable characters! Is > there anyway to force 4gl to send out my characters without striping the > NULs, etc. > > I have tried char/varchar/byte/ascii/standing on my head! > > Has anyone found a way to "handle" this problem? > > Steve > > -- > Steven L Cooper > Manager, Systems Engineering > --------------------------------------- > Please reply to NG only, so others may be enlightened... > The views expressed here are mine and > you can't have them...unless you agree! 4GL is based on C, which uses nul (zero) to represent the end of a string. So, you won't have much luck getting nuls out of most C code. Why not try sending some other unique character in place of nul and passing the output through tr, although I have a feeling tr complains! Try this little C program I looted from my utilities library: --- cut here --- /* **************************************************************************** tr0.c - filter to translate into nulls Peter Lancashire - 21 Jan 1996 **************************************************************************** */ #include <stdio.h> main(argc, argv) int argc; char *argv[]; { int ch; if (argc != 2) { fprintf(stderr, "usage: %s translation_char\\n", argv[0]); exit(1); } while ((ch = getchar()) != EOF) putchar((ch == *argv[1]) ? '\\0' : ch); } --- cut here --- -- Peter Lancashire Information Systems Specialist, Bayer plc Eastern Way, Bury St Edmunds, Suffolk, IP32 7AH, UK Tel: +44-1635-562258, Fax: +44-1635-562281 --- If all else fails, read the instructions and the release notes. Join Infuse, the UK Informix User Group at http://www.infuse.org.uk/ ---