Software :: Read The Output In Console By A Function In C?
Mar 7, 2010
How can i obtain the pid of a process, by using a function?Like i know if i write x = system("pidof teste"), x is not the pid of the program teste but it is equal to 0.How can i know the output of a command like that, but make it in a a program in C?
when the user clicks a button (assume war application) and the action'system.out.println' a message, how can I *remotly* read this message (read the message from a different computer instead of the server)?when I use the eclipse, I can read it from the console but if I'm in adifferent location, how can I see this message remotely?I'm thinking about remote debugging (JPDA), however, it's very difficult to configure in order to make JPDA run. I tried based on tutorial of google search, bug failed.I wonder if remote debugging can actually solve my problem. If not, is there any other to solve
I have taken into count spacing of functions as a reason for not working. Can you get this function to work on your machine? quickfind () { find . -maxdepth 2 -iname "*$1*" }
It does not print the retired output but find . -maxdepth 2 -iname "*$1*" does work. What is wrong? quickfind () { f ind . -maxdepth 2 -iname "*$1*" ; }
If I run this from the command line I don't get an error but no output? I am not running this inside a script but from the command line. I want to be able to run any function () from the command line. I have more functions that I can't get to work? tt () { tree -pFCfa . | grep "$1" | less -RgIKNs -P "H >>> " }
I'd like to redirect the output to a file and to the console. I know about tee but the issue is that it waits until the first process finishes.e.gecho "hello world" | tee test.txtfirst calls echo and then tee.Is there a way to redirect "on the fly" ?
When I run 'sendmail -bv', it sends the mail delivery status report as a mail to the root. Is there a way I can redirect this to the console instead of sending as a mail. requirement is to programatically find the mail host of the recipient for which I thought of using this 'sendmail -bv' command. Is there any other better way to find mail host of the recipient
I want to populate an array of string by files exists in directory on mounting of file system. I got an entry point for file system mount. I can use either do_mount function or fill_superblock function. But I am not clear about how to call readdir from there itself. I need inputs for calling readdir from fill_superblock function.
I'm using mplayer with shell-fm, in my shell-fm.rc I have the line extern = nice -10 mplayer -really-quiet -ao jack -cache 512 -noar -nojoystick -nolirc -noconsolecontrols -nomouseinput -demuxer lavf -lavfdopts format=mp3 -af-adv force=5:list=resample -af resample=44100:1:2:extrastereo-1.5 - This to me at least produces a pleasant audio output but despite the -really-quiet option mplayer is still outputting text, generally something like [mp3 @ 0xa3f5380] max_analyze_duration reached I've also tried the -msglevel all=-1 option and had a play with the MPLAYER_VERBOSE environmental variable, all with no joy.
when I use e. g. cat file.txt | grep --color=tty "pattern" I get the pattern I search highlighted. When I want some more context around each hit, grep has the -A, -B and -C parameters. However, I want to display the whole file (or whatever command output) and highlight a certain pattern. Does such a highlight command or tool exist?
Is there a way to color particular words printed on console based on user preference? For example I need to color text 'error' when a particular program is compiled.
Is there a way to get console output over a serial (COM) port? I have a box that I use as a NAS, DNS, DHCP and mt-daapd server, I don't have a spare monitor and it is not worth buying one just to use it once or twice a year.
I found this guide [url] but it doesn't work with Natty
i'm looking for a way to output a bash script to the console before login.It should be executed after boot in rc.d scripts with the output on the console0. It is for a asterisk box.This is the script. It use the watch command to output the active calls on the box in realtime.Code:watch "asterisk -vvvvvrx 'show channels verbose'"Btw,
Now i have a problem.I want to used a hid usb device under linux 2.6.11.But i can't know how to used ioctl function to send and receive data to a hid device
I am having a java program which will read characters from console. i have started my program from bash shell and now the program starts and waiting for the inputs. Say I have typed text , "hello". If i try to move the cursor position back wards using the left arrow button it was not working. Instead some junk characters are printed on the console like ^[[C .
hello^[[C^[[C^[[C^[[C^[[C
Below is my program.
public static void main(String as[]) { BufferedWriter outputWriter = new BufferedWriter(new PrintWriter(System.out));
When I try to play a dvd and give mplayer no options, it defaults to "X11" for the video output, which maxes out the cpu. To get around this, firstly I tried to play the dvd using "cvidix" in the console.
I used the following command: mplayer -ao alsa -vo cvidix -fs -framedrop -stop-xscreensaver -dvd-device /dev/dvd1 dvd://1 This played the dvd, but the console text was still visible over the top of the movie; i.e. mplayer was playing in the layer beneath the console text
Then I tried using xvidix in X: mplayer -ao alsa -vo xvidix -fs -framedrop -stop-xscreensaver -dvd-device /dev/dvd1 dvd://1 This gives a green line about 5mm thick down the right side of the screen, but other than that it is ok.
The author (somewhere on these Ubuntu forums directed........ Ctrl + Alt + F1 which I thought was going to be the "Terminal" but nothing similar. I have about a half dozen different names/passwords for Ubuntu but none will work to log in. How to get out of this text console and back to Ubuntu GUI? And, how to read my lost LogIn name and password for this "Text Console"?
how should I read below output of lm_sensors ? Im interested ONLY with temp1 and temp2.I suspect that temp1 presents motherboard chipset temp and temp2 CPU temp. I hope this is like this... but I have no 100% assurance.
i have wrote a long piece of code above with the "main" which is calling openFile( &fout, filename )filename contains the txt name in a form of "data.txt"i wanna read the data from the file and output it into fout for later use.the data in that file is a vector looking interger group.i have the following code:
I'm using Ubuntu and I'm programing with eclipse CDT. My goal is to execute a php file and read the output to my c++ program. To do so I thought I should use fork(), dup2() and execl. When in shell, the call "php myscript.php" worked just fine, but when in c++ I tried: execl("usr/bin/php", "php", "home/geiger/workspace/SemiServer/server_content/myscript.php", NULL); And it didn't work (the process wasn't terminated and I got no output). I tried different version of this call, like losing the "php" string and/or drop "home/geiger" from the path string, to no better result.
file1: have DNA sequences and each sequence will begin with > symbolfile2: have protein sequence and each sequence will start with > symbolfile3: BLAST result of file2 and each result will start with query= .my problem is i have to make a report file by combining these three in such way that first sequence from file1,first sequence from 2nd file and first result from file3 should be printed in a report file
I'm having a slight dilemma on reading data from a text file and outputting it into a table then displaying it. Basically I'm writing a shell script that takes information from text files then outputs the data into a table with 4 headings.he extracting of the data is fine, but creating a table i'm having problems with. I think it is possible to do it using the awk function, but so far i'm having a lot of difficulties.
I am using read() in c++ to get data from a serial port. However, if no data is available on the serial port the function blocks until dta arrives.Example code:
Pavillion laptop crashed and I can not find all of my recovery discs. The computer will not allow me to do an internal recovery so I ordered a recovery download on line and burned to a disc. when I put the disc in the graphics came up and in started in Live-mode but then the error mess came: error while loading shared libraries: /usr/lib/libpci.so.3: cannot read file data: input/output error. The site said it was an ISO file but then it had a program it had me run to change it and burn the disc.
I have the following code: Code: #include <stdio.h> #include <stdlib.h> int main() { system("ps -ef | grep myprocessname"); return 0; }
When I run this program it outputs the following list of running processes: Code: root 10279 10275 0 13:02 ? 00:00:00 myprocessname myvar1=value1 myvar2=value2 root 10341 10337 1 13:02 ? 00:00:00 myprocessname myvar1=value1 myvar2=value2
What I want to really do is instead of writing the output to screen I want to read the output and parse the various values value1, value2 etc. What is the best way to do this?
After upgrading from Ubuntu 9.10 to 10.4 the console output stops during bootup at various points (during init final scripts processing and when the tty1 auto login). This is a colinux environment but has nothing do with the problem as it is the same version of colinux kernel that works correctly with 9.10 but exhibits the problem with in version 10.4 Lucid.
when tty1 using mingetty auto logs in the .profile file starts the gnome-session (command: DISPLAY=$DISPLAY dbus-launch gnome-session &) and when the panel comes up the shutdown button is disabled when it should be enabled.
However, if during the bootup when the console output stops, I immediately toggle to virtual console 2 (tty2) and immediately toggle back to virtual console 1 (tty1) it restores the output to the console and when bootup completes the gnome panel has the shutdown button enabled as it should be. Some times when the console output stops it looks like a screen clear was issued and other times the lines remains an the screen. I added --noclear to the line that calls mingetty in /etc/init/tty1.conf but is has no effect.
I have mounted an NFS share with ISO images on my kvm Server. If i connect such a iso to a VM (using virt-manager) for installing a operating system i get the following error on startup: Error starting domain: internal error Process exited while reading console log output: char device redirected to /dev/pts/1 qemu: could not open disk image /mnt/iso/public/Linux/Distributions/Debian/debian-504-amd64-netinst.iso: Permission denied
The problem is definitly that kvm (or qemu or libvirt-bin, i don't know) tries to set permissions (rwx owner for libvirt-qemu, --- for kvm group, --- for other) on the file, although it has read permissions. Is it possible to change this behavior?
1. need to run like a daemon which will read an active squid logfile in a refresh pattern of 5 minutes
2. calculate the total number requests based on different domains that the client access
3. calculate the total of number of requests based on different domains as well as the turnaround time of these access is more than 5 sec that the client access
4. calculate percentage of item 3 over item 2
5. report the results in html format as follows:
Domain Name Total req Req > 5 sec % of req > 5 sec
I bought a multifunction stylus sx218 Espon model and I can not run the scanner function. I did some research and found a few solutions and very functional. I hope someone solves the problem. My version of openSUSE 11.2.
I am doing some Linux kernel programming for my research project. I need to record the timestamp (by using cpuid and rdtsc) when an interrupt handler (top half) is first invoked. Due to the time critical nature of the problem itself, I have to do the timestamping inside the interrupt handler itself (the first operation when the handler is called). However, I understand that tasks that are not so time critical should be deferred to a tasklet function (bottom half) for processing because other interrupts are disabled in a (top-half) interrupt handler. I am currently out of idea on how I can pass the timestamp information that I have obtained in the interrupt handler to the corresponding tasklet function.