I'm writing a console app (in C#) and I want to be able to redirect the
standard input/output streams when it's run at a command prompt. IOW I want
to support the "<" and ">" redirection syntax. The obvious way to do this is
by using the static Console type properties, In and Out. When trying to
debug the app in the IDE however, this doesn't appear to work. I've edited
the project properties and added the necessary text to the "command line"
argument property, but no joy.
So, have I missed something? Is there a way to simulate redirection from
within the IDE for a Console app?
Thanks in advance,
Bill 3 7778
Have you tried Console.SetIn() and Console.SetOut( )? The ">" redirection
syntax is handled by the command-line interpreter and the IDE doesn't
simulate that. It just treats it as a regular string and the redirection
command gets passed as a string argument, which it looks like you've
discovered.
"Bill Cohagan" <bi**@teraXNOSP AMXquest.com> wrote in message
news:#B******** ******@TK2MSFTN GP09.phx.gbl... I'm writing a console app (in C#) and I want to be able to redirect the standard input/output streams when it's run at a command prompt. IOW I
want to support the "<" and ">" redirection syntax. The obvious way to do this
is by using the static Console type properties, In and Out. When trying to debug the app in the IDE however, this doesn't appear to work. I've edited the project properties and added the necessary text to the "command line" argument property, but no joy.
So, have I missed something? Is there a way to simulate redirection from within the IDE for a Console app?
Thanks in advance, Bill
Bret-
Yes, I've tried SetIn and SetOut, but that means I have to execute
different code in the IDE than I do "in real life", not a very robust
situation. As it turns out I'm having major problems with just using
Console.In in the EXE; i.e., not in the IDE. I'm building a validating XML
reader around that input stream and I'm getting an error complaining that
the object doesn't support a write (?).
Thanks for the response,
Bill
"Bret Mulvey" <br***@microsof t.nospam0000.co m> wrote in message
news:Jkldb.6001 84$Ho3.117213@s ccrnsc03... Have you tried Console.SetIn() and Console.SetOut( )? The ">" redirection syntax is handled by the command-line interpreter and the IDE doesn't simulate that. It just treats it as a regular string and the redirection command gets passed as a string argument, which it looks like you've discovered.
"Bill Cohagan" <bi**@teraXNOSP AMXquest.com> wrote in message news:#B******** ******@TK2MSFTN GP09.phx.gbl... I'm writing a console app (in C#) and I want to be able to redirect the standard input/output streams when it's run at a command prompt. IOW I want to support the "<" and ">" redirection syntax. The obvious way to do
this is by using the static Console type properties, In and Out. When trying to debug the app in the IDE however, this doesn't appear to work. I've
edited the project properties and added the necessary text to the "command
line" argument property, but no joy.
So, have I missed something? Is there a way to simulate redirection from within the IDE for a Console app?
Thanks in advance, Bill
Hi Bill,
Can you check my replied to your another post in this queue?
Subject: Write error on Read() ??
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
-------------------- From: "Bill Cohagan" <bi**@teraXNOSP AMXquest.com> References: <#B************ **@TK2MSFTNGP09 .phx.gbl>
<Jkldb.600184$H o3.117213@sccrn sc03>Subject: Re: Console app (Debug)- how to redirect standard input/output? Date: Sat, 27 Sep 2003 15:19:22 -0500 Lines: 46 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Message-ID: <ug************ **@TK2MSFTNGP11 .phx.gbl> Newsgroups:
microsoft.publi c.dotnet.genera l,microsoft.pub lic.dotnet.lang uages.csharpNNTP-Posting-Host: cs24313-53.austin.rr.co m 24.243.13.53 Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP11.phx.g bl Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.csharp:1877 16
microsoft.publi c.dotnet.genera l:110126X-Tomcat-NG: microsoft.publi c.dotnet.genera l
Bret- Yes, I've tried SetIn and SetOut, but that means I have to execute different code in the IDE than I do "in real life", not a very robust situation. As it turns out I'm having major problems with just using Console.In in the EXE; i.e., not in the IDE. I'm building a validating XML reader around that input stream and I'm getting an error complaining that the object doesn't support a write (?).
Thanks for the response, Bill
"Bret Mulvey" <br***@microsof t.nospam0000.co m> wrote in message news:Jkldb.600 184$Ho3.117213@ sccrnsc03... Have you tried Console.SetIn() and Console.SetOut( )? The ">" redirection syntax is handled by the command-line interpreter and the IDE doesn't simulate that. It just treats it as a regular string and the redirection command gets passed as a string argument, which it looks like you've discovered.
"Bill Cohagan" <bi**@teraXNOSP AMXquest.com> wrote in message news:#B******** ******@TK2MSFTN GP09.phx.gbl... > I'm writing a console app (in C#) and I want to be able to redirect the > standard input/output streams when it's run at a command prompt. IOW I want > to support the "<" and ">" redirection syntax. The obvious way to dothis is > by using the static Console type properties, In and Out. When trying to > debug the app in the IDE however, this doesn't appear to work. I've edited > the project properties and added the necessary text to the "commandline" > argument property, but no joy. > > So, have I missed something? Is there a way to simulate redirection
from > within the IDE for a Console app? > > Thanks in advance, > Bill > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Robert |
last post by:
Simple way of writing debug print statements in your JavaScript code.
You need to have enabled popups in your browser.
I liked the ability to write to the java console in Netscape 4.x.
This, ability is missing in IE and the latest versions of Netscape.
Maybe someone knows a better way and can improve on this code, the
following JavaScript code demonstrates how to write debug statements
in a JavaScript program.
I sure lots of people...
|
by: MuZZy |
last post by:
HI
I just wonder if someone can help me with this:
I have a windows app project developed on VC++ 6.0.
I need to adapt it to be able to compile as a console app as well
(So it would call main() instead of WinMain())
I created a new profile for the project and replaced precompile define _WINDOWS by _CONSOLE,
and changed linker option /subsystem:windows to /subsystem:console.
|
by: ion |
last post by:
Hi!
Is there a way to write messages to the javascript console? Like a
debug.write() method?
Thanks!
Ion
|
by: Franco, Gustavo |
last post by:
Hi,
Console.WriteLine does something on Release mode?
I have many of them in my application and I want to know if the performace
could be affected, on debug mode I can see a big difference between having
and not because I'm printing many of them on loops, etc.
Now, in Release mode Console.Writeline has something like #if (!Release),
send the string to something like "/dev/null" or it is executed internally
|
by: ~toki |
last post by:
I have a full work app (server and client) that talk between two executables
trought Console.WriteLine(); & Console.ReadLine();
I have the source code of the server.
I need to make the client. To do this i have
Console.WriteLine("Hi server");
while (true)
| |
by: Grey |
last post by:
Can I use System.Console.WriteLine('fasfasdf') in ASP.NET development as I need to print out some message in the console during the debug stage..
|
by: Sagaert Johan |
last post by:
Hi
Can a lot of Console.Writeline commands cause a program to run slower ?
johan
|
by: Michael D. Ober |
last post by:
Is there anyway the VB Compiler can detect if a program is a console
application? I have some libraries that need to write to the console if
the program is a console app.
Thanks,
Mike Ober.
|
by: Marin |
last post by:
Right now my solution to this is adding Console.ReadLine at the end but I'm
wondering if it's possible to do it automatically?
If I chose "Start without debug" it does just that, it pauses right before
the console window closes, but "Start with debug" closes the window right
away.
|
by: kj |
last post by:
How can a script send (non-fatal) warnings and other such messages
to Firefox's JavaScript console?
Thanks!
kj
--
NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |