[mod.computers.vax] VMS output

rick@SIEMENS.UUCP (03/06/86)

	 I've been having a problem with output on VMS C.  I am in the
	 process of porting a graphics program from UNIX to VMS.  My
	 problem concerns the driver for a Raster Technologies' Model
	 One/10 terminal.  

	 On UNIX, everything works fine.  I send lots and lots of ASCII
	 characters to the terminal and it interprets them as hex
	 digits and I get pretty pictures on the screen.  

	 On VMS, I send lots and lots of ASCII characters to the
	 terminal but the computer decides that no one would really
	 want to output so many characters without a newline now and
	 again so every 256th character is a newline.  The Model One
	 indiscriminately tries to interpret this as a command and then
	 tries to interpret the following characters as arguments to
	 the command.  I get nasty error messages from the terminal and
	 messed up pictures on the screen.

	 I tried to setbuf(stdout,NULL) but it doesn't work.  I also
	 tried a lot of ugly kluges including sprintf(...)ing the
	 commands and write(...)ing the string to stdout.  No luck.

	 I would be grateful for any ideas or solutions.

	 Rick Taft
	 Siemens Research and Technology Laboratories
	 105 College Road East
	 Princeton, NJ 08540

	 (609) 734-3324
	 FAX: (609) 734-6565
	 UUCP: {vrdxhq,cwruecmp,princeton,astrovax,
	        inhp4,drexel,jandj,columbia   }!siemens!rick

		===================================
		= Ad Hoc, Ad Loc and Quid Pro Quo,=
		= So much to do, so much to know! =
		===================================

KFL@MC.LCS.MIT.EDU ("Keith F. Lynch") (03/08/86)

    From: princeton!siemens!rick@siemens.ARPA

    On VMS, I send lots and lots of ASCII characters to the terminal but the
    computer decides that no one would really want to output so many
    characters without a newline now and again so every 256th character is a
    newline.

  I don't know how this is done in C, but what you want to do is open
the file so that the CARRIAGECONTROL attribute has the value NONE.

								...Keith

rcb@RTI-SEL.UUCP (Random) (03/10/86)

In article <510520825.rick@siemens> you write:
>
>	 I've been having a problem with output on VMS C.  I am in the
>	 process of porting a graphics program from UNIX to VMS.  My
>	 problem concerns the driver for a Raster Technologies' Model
>	 One/10 terminal.  
>
>	 On VMS, I send lots and lots of ASCII characters to the
>	 terminal but the computer decides that no one would really
>	 want to output so many characters without a newline now and
>	 again so every 256th character is a newline.

Deja Vu!!!! I think I've been here before!!! As it turns out, the VMS
C stdio stuff is not very good for pure binary output to terminals as
it does not have an ioctl to set a raw mode. You will need to use
QIO to set ther terminal line to pasthru. This may be enough to allow the
use of C io calls. I personally use QIO's for all the io to graphics devices
so that I know exactly what is going on. All you need is one routine
to write a character and one to flush the buffer in the first routine.
I would definately suggest doing some buffering if you use qio's. The overhead
is just too much for one character at a time. 

					Random (Randy Buckland)
					Research Triangle Institute
					...!mcnc!rti-sel!rcb

seaton@DEC-BLOTT.UUCP (Ian Seaton, Dedicated Mail, REO2-F/D3, DTN 830 3) (03/12/86)

> "rick@siemans" writes that VMS is giving him newlines   <
> every 256 characters when writing from a VAX C program :<

The most likely solution to your problem is that unlike UNIX, VMS has
`half-a-million' different ways to open an output stream and you've
got the wrong one. (Hardly surprising :-))

The one you probably want is to open your output stream like:

	fd = open( "tt:", O_RDWR, "ctx=bin" );

which tells RMS that you want to read and write binary not text.

eg

#include stdio
#include file
main()
{
int fd, i;

	fd = open( "tt:", O_WRONLY, "ctx=bin" );
	for( i = 0; i < 512; i++ )
	    write( fd, "A", 1 );
	close( fd );
}

Should write out 512 `A's without break.

     Share and Enjoy...

          Ian Seaton
                    DEC Reading, England

UUCP:                              !dec-thrint!
                    decwrl!dec-rhea!dec-tron  !seaton
                                   !dec-blott !

ARPA:               seaton%tron.DEC@DECWRL.ARPA

egisin@WATERLOO.CSNET (Eric Gisin) (03/13/86)

the easiest way to prevent insertion of returns
is by opening or fopening with the rms "rfm=udf" attribute.
set the terminal /nowrap and possibly /pasthru.
this works for files sent to a print queue also.

egisin@WATERLOO.CSNET (Eric Gisin) (03/13/86)

Actually, I can't duplicate the problem with my test program:

#include <stdio.h>
     
main() {
        int     i;
        char buf [1000+1];
        freopen("tt:", "w", stdout /*"rfm=udf"*/);
        for (i=0; i<1000; i++)
                buf[i] = 'x';
        buf[i] = '\0';
        fputs(buf, stdout);
}

No extra characters appear in the output.
I've got VMS 4.2 and C 2.1.