need help with C and a "command line?"

This is a discussion on need help with C and a "command line?" within the C Programming forums, part of the General Programming Boards category; I am using Microsoft Visual Studio C++ 6.0 and I have a simple little code ( "dbl_out") that I can't ...

  1. #1
    Registered User
    Join Date
    Dec 2002
    Posts
    1

    need help with C and a "command line?"

    I am using Microsoft Visual Studio C++ 6.0 and I have a simple little code ( "dbl_out") that I can't figure out how to invoke. I can open up a workspace, a .c file, build/compile and run this program and it works, however my problem is... How do I invoke this program using redirection. My book says that it can do it four different ways: dbl_out, dbl_out < infile, dbl_out >utfile, and dbl_out <infile >outfile. What the heck does this mean? Are there other ways to get this program to work besides pressing the execute button in MSVS? Can anyone deliver insight?


    Code:
    #include <stdio.h>
    
    int main (void)
    {
    	char c;
    
    	while (scanf ("%c", &c) == 1) {
    		printf ("%c", c);
    		printf ("%c", c);
    	}
    	return 0;
    }

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    >>Are there other ways to get this program to work besides pressing the execute button in MSVS?
    Yes, get to a console prompt (DOS prompt), and CD you r way to the directory where you .exe is. Type it's name, and voila, it'll run.

    dbl_out Will run the program and wait for you to type something a press enter.

    dbl_out < infile Instead of reading input from the keyboard, you program will read infile and process the contents of it.

    dbl_out >utfile This is the same as option 1, but with the output redirected to utfile (presumably a typo, meant to be outfile). Output will normally go to the screen.

    dbl_out <infile >outfile This is option 2 and 3 combined.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21