QueryCAT Logo
Search 5,000,000+ questions and answers.

Frequently Asked Questions

How can I execute a command with system() and read its output into a program?

The C Language FAQ
Unix and some other systems provide a popen() routine, which sets up a stdio stream on a pipe connected to the process running a command, so that the output can be read (or the input supplied).

How can one program read another's output?

Frequently Asked Questions about PhysioNet
If you are running programs from a command prompt (by typing commands into a terminal emulator window or an MS-DOS box), these things can be done easily. If you have ever used GNU/Linux, Unix, or MS-DOS, you may have captured the output of a program by redirecting it to a file, like this: foo >bar The > operator redirects foo's standard output (which would normally appear on-screen) into a file named bar. If bar exists already, its contents are replaced.

Sect. 18) How do I execute a command in my program?

Java Programmer's FAQ - Part D
Use Runtime.getRuntime().exec( myCommandString ) where myCommandString is something like "/full/pathname/command". An applet will need to be signed in order to allow this. If the pathname contains spaces, e.g. "c:\program files\windows\notepad", then enclose it in quotes within the quoted string. Or pre-tokenize them into elements of an array and call exec(String[] cmd) instead of exec(String cmd). From JDK1.3 there are two new overloaded Runtime.exec() methods.

How do I hide the output of the send command?

Expect FAQ (Frequently Asked Questions)
From: tim@mks.com (Timothy D. Prime) Subject: Re: hide the text of expect's send command? Date: 29 Mar 1996 15:41:02 GMT In article <khughesDoy1yH.5zo@netcom.com>, Kirby Hughes <khughes@netcom.com> wrote: > I don't want to see (on the screen) the text sent by a "send" command. Is > there a way to hide it? "log_user 0" works for text coming back to me, but > doesn't (seem to) work for sending..

How do I execute command foo within function foo?

Z-Shell Frequently-Asked Questions
The command command foo does just that. You don't need this with aliases, but you do with functions. Note that error messages like zsh: job table full or recursion limit exceeded are a good sign that you tried calling 'foo' in function 'foo' without using 'command'. If foo is a builtin rather than an external command, use builtin foo instead.

How can I invoke another program or command and trap its output?

System Dependencies
Unix and some other systems provide a popen function, which sets up a stdio stream on a pipe connected to the process running a command, so that the calling program can read the output (or alternatively supply the input). Using popen, the last example from question 19.28 would look like extern FILE *popen(); sprintf(cmdbuf, "sort < %s", datafile); fp = popen(cmdbuf, "r"); /* ...now read sorted data from fp..

Sect. 18) OK, how do I read the output of a command?

Java Programmer's FAQ - Part D
above (18.8, 18.9), adjusted like this: BufferedReader pOut= new BufferedReader( new InputStreamReader(p.getInputStream())); try { String s = pOut.readLine(); while (s != null) { System.out.println(s); s = pOut.readLine(); } } catch (IOException e) { } Another possibility is to read chunks of whatever length as they come in: ... p = r.exec(cmd); InputStream is = p.getInputStream(); int len; byte buf[] = new byte[1000]; try { while( (len = is.

How long does it take to execute a command?

FAQ about PMC Motion Controllers
For our MultiFlex and DCX Series of PCI-bus controllers (MultiFlex PCI 1440, MultiFlex PCI 1040, DCX-PCI300, DCX-PCI100, the command execution time is typically on the order of 50-100 microseconds per command. When using Pentiun III class computers or above, PMC's legacy ISA-bus controllers can achieve 1,000-1,500 commands and responses per second. For our PCI-bus controllers, the command rate is higher - typically in the range of 5,000-10,000 command-and-response cycles per second.

How can I invoke an operating system command from within a program?

Infrequently Asked Questions in comp.lang.c
Ask the user to open a new shell. The best way to do this is system("echo Please open a new shell now."); sprintf(cmdstring, "echo Enter the command '%s' in it.", cmd); system(cmdstring); The traditional solution, pioneered by Microsoft, is to sell enough copies of your proprietary, slow, and limited software that everyone else supports your formats.

How do I execute a servlet from the command line, or from Unix shell program or Windows BAT file?

jGuru: Servlets FAQ Home Page
Of course as with any Java class, you could put a "main" method in your class that extends HttpServlet, so you could run it (the main(), not the doGet...

How can I execute more than one command in the need-op settings?

The Eggdrop FAQ: Running the bot
The best is to create a separate procedure to handle everything you need: chanset <#channel> need-op "need_op_cmd <#channel>" proc need_op_cmd { channel } { command1 command2 ... } To do this, you need to edit the first line of the config to make it point to the full path of where your eggdrop binary is. For example you have

How do I save the output of command that I have executed?

COSC 2410: Computer Organization and Programming Lab Web Pag...
To save the output of a command that you have executed you must first open a DOS command prompt. At the command prompt type "[EXECUTABLE] > [DESTINATION FILE]" and press enter. The string "[EXECUTABLE]" is the name of the command which you wish to save the output of. The string "[DESTINATION]" is the name of the file in which you wish to store the output. Once you have pressed enter, you have saved the output to a file with the name in which you specifed in the destination.

How can I execute an xsimulator program on another machine?

CADP FAQ
You can, provided that the other machine is the same type (i.e. architecture and operating system) than the machine on which xsimulator was produced. If the other machine has CADP installed, there is no problem, be sure that the $CADP environment variable is correct. If the other machine does not have CADP installed on it, you have to copy xsimulator and some other files from the the CADP release in order to make xsimulator work.

Why doesn't my program generate Memory Advisor output after I build it using the memadvise command?

Frequently Asked Questions
When your program exits, you should at least see a leak report or a report stating that there were no leaks. If you do not get this output, you have probably not enabled Memory Advisor. Be sure that you have set the MA_ENABLED option to on in your environment or in one of the Memory Advisor configuration files. By default, this option is on. In addition, check the value of the MA_ERROR_FILE option, which could be redirecting the error output to a file.

How can the output of a command line operation be retrieved?

AutoHotkey FAQ
Testing shows that due to file caching, a temporary file can be very fast for relatively small outputs. In fact, if the file is deleted immediately after use, it often does not actually get written to disk. For example: RunWait %comspec% /c dir > C:\My Temp File.txt FileRead, VarToContainContents, C:\My Temp File.txt FileDelete, C:\My Temp File.txt To avoid using a temporary file (especially if the output is large), consider using CmdRet. Alternatively, there is a small freeware utility cb.

Can one execute an operating system command from PL/SQL?

PL/SQL FAQ - Oracle FAQ
There is no direct way to execute operating system commands from PL/SQL. PL/SQL doesn't have a "HOST" command, like in SQL*Plus, that allows users to call OS commands. Nevertheless, the following workarounds can be used: Write an external program (using one of the precompiler languages, OCI or Perl with Oracle access modules) to act as a listener on a database pipe (SYS.DBMS_PIPE). Your PL/SQL program then put requests to run commands in the pipe, the listener picks it up and run the requests.

How can I execute a remote job and redirect the output to my local machine?

FAQ - Java CoG Kit
The following code snippet may give you an indication how to do this. // Create a JobSpecification JobSpecification spec = new JobSpecificationImpl(); // Add all the required parameters like executable etc. spec.setExecutable(/bin/executable); // Redirect the output to the local machine spec.setRedirected(true); // On the local machine, the if output needs to be redirected to the // cog-abstractions-output.txt file, use the spec.setStdOutput() method.

How do I output to multiple files from one output program?

Answers to Questions
First, create a device for each filename you wish to output to; device type should be COMM - example: FILE 1 path = %ETROOT%/tmp/file1 Third, in your output program, at "when start" you should call a bat file you have created to delete the files you are outputting to (so that each output is not appended to the previous output).

How can I replace the command associated to the ps2pdf button to execute Acrobat Distiller?

WinEdt.org -- Help & Documentation -- FAQ
Alex doesn't maintain macros for Acrobat Distiller (work is hard enough to keep up with the changes that every new Acrobat Reader version has in its baggage), but he provided clear instructions on the mailing list on how to set up such a customization yourself. or if this for some reason fails replace %$('Acro-Bin'); with full path to acrodist.exe enclosed in double quotes, eg.: "C:\Program Files\Adobe\Acrobat 6.0\acrodist.

Who can execute a will?

Inspector Genaral of Stamps and Registration
a) Any person above the age of 18 years and mentally sound may execute will, but will caused by fraud or coercion or by importunately will not be valid. Therefore a will must be executed voluntarily. d) Scribe (deed writer / advocate) cannot be called witness. Two independent attesting witnesses other than the scribe or necessary. In order to avoid disputes in implementation of a will, description of property and the beneficiaries should be clearly be written without giving room for any doubt.
More Questions >>

© Copyright 2007-2012 QueryCAT
About • Webmasters • Contact