Interfacing C and UNIX in SunView?

Jonathan I. Kamens jik at athena.mit.edu
Wed Aug 1 10:50:20 AEST 1990


  (Note the Followup-To, which *should* have been included with the original
article.  The article doesn't belong in comp.unix.wizards in any case.  Heck,
it shouldn't have even been posted to the net, considering that the original
poster could have found out the answers to his questions by typing "man -k
execute", or "man -k command", or by asking a more knowledgeable programmer at
his site (the best solution).)

In article <139856 at sun.Eng.Sun.COM>, jasonf at cetemp.Eng.Sun.COM (Jason Freund) writes:
|> 
|> 	I'm writing a C program in the SunView 4.0 environment.  My
|> program will, eventually, open up in its own window (using a SunView function)
|> and do some stuff (like manipulate files).  I want my C program to be able to 
|> to execute simple UNIX command sequences from inside its SunView window to 
|> make my programming job much easier -- like "lpr -<printer> <file>", 
|> "rm <file>", etc. so that I don't have to write equivalents in C.  Speed is 
|> not a factor, but the fact that the program uses the shell (or it opens a new 
|> window and uses its shell) should be hidden as much as possible.

  See the man pages in section 3 of the manual for the library functions
system() and execl().  For example, system("lpr -<printer> <file>"); will
execute the lpr command.

Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik at Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8495			      Home: 617-782-0710



More information about the Comp.unix.questions mailing list