473,396 Members | 2,026 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Getting console output

4
Hi again!

I need some help \ pointers on how to get the output generated in a console after you run a system command into a text widget (Perl Tk). I feel rather confident that I could get the data put into the widget if I could actually GET the data to begin with, but I can't seem to get this done :(

e.g. system "someAppThatGeneratesConsoleOutput.exe" -> get the output that is generated from this..

Can't really explain any better, hope you understand :) Seen this done before (cross linux\windows with a simple method..) But I don't have that code anymore and I cant seem to remember how.
Feb 13 '09 #1
3 3186
nithinpes
410 Expert 256MB
You may use reverse quotes to run the system command and capture the results into a variable and later insert it to Tk Textbox:
Expand|Select|Wrap|Line Numbers
  1. my  $TextBox= $fr->Scrolled( 'Text', '-scrollbars' => 'e', '-background' => 'yellow',       
  2.   )->pack( -fill => 'both', -expand => 1, -side => 'bottom' );
  3.  
  4. my @res=`dir /w`; ##Pass your comand within reverse quotes
  5.  
  6. $TextBox->insert('end',"@res");
  7.  
Feb 15 '09 #2
KevinADC
4,059 Expert 2GB
You can also use what I think is a more readable quoting operator that does the same thing as the backtiks:

my @res= qx{dir /w};
Feb 15 '09 #3
EDPB
4
Ah Wonderful! :D Thanks a lot =)
Feb 15 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Matthew Crouch | last post by:
I'm an utter newbie to java, but I'm curious where to look for information on more or less "scraping" applets. I found a site that says applet output goes to "system console" on OSX, but since...
16
by: Chris Maloof | last post by:
Hello, Does anyone know how I can read the ASCII text from a console window (from another application) in WinXP? It doesn't sound like a major operation, but although I can find the window via...
2
by: Boba | last post by:
Hi, I'm programming a WinForm application. I would like to enter commands that will send output that will help me to locate bugs in the future. I know that there is a way to send output by...
5
by: Barry Mossman | last post by:
Hi, can I detect whether my class is running within the context of a Console application, vs say a WinForm's application ? also does anyone know whether the compiler or runtime is smart enough...
4
by: Bob | last post by:
I just recently noticed that when I start my applicatoin in debug mode, the IDE hangs (no disk or CPU activity) indefinitely (at least 20 minutes). Pausing the application shows that it's hung up...
6
by: Christian Convey | last post by:
Hello, I've got a program that (ideally) perpetually monitors sys.stdin for lines of text. As soon as a line comes in, my program takes some action. The problem is, it seems like a very large...
2
by: Danny Gagne | last post by:
I'm currently working an .net application (I can use 1.1 or 2.0 if needed) that needs to read a wsdl file and generate another piece of code that can use it. I'm encountering a problem where I...
1
by: John Bailo | last post by:
This is a my solution to getting an Output parameter from a SqlDataSource. I have seen a few scant articles but none of them take it all the way to a solution. Hopefully this will help some...
3
by: TC | last post by:
I'm trying to debug a console application, but I can't see the console output. I've seen many references which say that console output is supposed to appear on the Output window when the...
11
by: Hotrod2000 | last post by:
I'm quite new to programming but I'm having problems getting a timer to work in visual studio.net I've created a timer on a form, enabled it and then typed the following code (from the mdsn...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.