GIDForums  

Go Back   GIDForums > Computer Programming Forums > C Programming Language
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 24-Apr-2006, 02:55
Cindy S Cindy S is offline
New Member
 
Join Date: Apr 2006
Posts: 4
Cindy S is on a distinguished road

Redirection within Microsoft Visual Studio.Net 2003


I am on my last lab assignment for the class. The code portion of the assignment is written, complied, and working. However, the last part of the question asks, What happens when the output is redirected, is the screen still cleared? (I was to include the system("cls") function at the beginning of a program that was already written in a previous chapter). The problem is that I cannot figure out how to make the redirection work so I can find the answer. I've tried compiling the program inside and then going out to the command prompt and I have tried the command prompt inside Visual Studio but can't get it to work. Can anyone help with step-by-step directions?
Thanks!
I have to tell you all. This forum is favored and commended over the others out there for the genuine help and lack of smack and attitude toward the student/beginner/inexperienced programmer. Thanks a bunch from all of us that are still trying.
  #2  
Old 24-Apr-2006, 09:29
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 4,623
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold

Re: Redirection within Microsoft Visual Studio.Net 2003


Quote:
Originally Posted by Cindy S
I am on my last lab assignment for the class.

Ahhh, now just to get past this and go out and breathe in some of the fresh, clean springtime air or whatever, right?

I can't tell exactly what the assignment really means, but here's something you can try. Compile the following program and then go to a command prompt in the same directory that contains the executable.

CPP / C++ / C Code:
#include <stdio.h>
#include <stdlib.h>

int main()
{
  system("cls");
  printf("Four score and seven years ago, yadda, yadda, yadda...\n");
  return 0;
}

Now, enter the program name. Suppose it's named test.exe:

Code:
test

What happened?

Now redirect the output to a file:

Code:
test >test_redirected.txt

What happened? Is there a file named "test_redirected.txt"? What is in the file? There may be a non-printing character in the file, so a text editor may or may not show what's there (depends on what editor you use). Maybe you have a hexadecimal editor or dump command on your system that lets you see what is in the file. Or maybe you can write a small C program to display the contents in hexadecimal (for extra credit???)

Here's another test:

CPP / C++ / C Code:
#include <stdio.h>
#include <stdlib.h>

int main()
{
  system("cls > x.out");
  printf("Don't panic!\n");
  return 0;
}

Try this with and without command line redirection. Interesting, huh? (Well, it's interesting to me, anyhow.)

Regards,

Dave
  #3  
Old 24-Apr-2006, 21:35
Cindy S Cindy S is offline
New Member
 
Join Date: Apr 2006
Posts: 4
Cindy S is on a distinguished road

Re: Redirection within Microsoft Visual Studio.Net 2003


Quote:
Ahhh, now just to get past this and go out and breathe in some of the fresh, clean springtime air or whatever, right?

I wish! I had two language classes this semester and have to finish the second half of my Java class before I can take a break. But, I will have my Associates. Then just 12 short classes and I earn the big BS.

Anyway, thanks for the reply. I e-mailed my instructor at the same time, and have yet to hear from him. Distance Learning/Self Study is a hard road because of this. It's a huge help to have avenues like this to help when you can't get it anywhere else. I haven't had a change to try your example - still doing the after work chores. But, I will in the next little bit. I'll let you know if I still have issues.
Thanks again!
 
 

Recent GIDBlog2nd Week of IA Training by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Microsoft visual studio 6 nadavsh MS Visual C++ / MFC Forum 0 05-Mar-2006 05:39
Install prob. with MS Visual C++ 2003 on XP. PeteGallo MS Visual C++ / MFC Forum 0 10-Feb-2006 19:28
Visual Studio .NET 2003 problem in executing C source files Debugger1 C Programming Language 14 04-Jun-2005 02:51
Why my Visual Studio.Net doesn't have Windows Forms Application(.Net) template? Where george MS Visual C++ / MFC Forum 9 18-Feb-2005 05:42
What is "Ambigious symbol" ??*( a compilation error) small_ticket CPP / C++ Forum 2 07-Jan-2005 21:10

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 19:09.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.