Thread: Help me?

  1. #1
    TransparentMember correlcj's Avatar
    Join Date
    Jun 2002
    Posts
    378

    Help me?

    Hello there,
    I have the following code which is called dbl_out. I need to redirect this to the file temp. I understand that if i write dbl_out.exe < temp it should copy it there but i dont know if i am doing it right. After i compile it using the visual C++ software what do i go from here. Do i have to bring up the msdos prompt and type in dbl_out.exe>temp or can i do it in visual C++ once i hit run.
    HELP?


    #include<stdio.h>

    int main(void)
    {
    char c;
    while (scanf("%c", &c) ==1) {
    printf("%c", c);
    printf("%c",c);
    }
    return 0;
    }
    "Be formless, shapeless, like water... You put water into a cup, it becomes the cup, you put water into a bottle, it becomes the bottle, you put it in a teapot, it becomes the teapot... Now water can flow, or it can crash, be water my friend."
    -Bruce Lee

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Just get to a DOS prompt, go to your programs directory and do
    c:\>myprog.exe >outfile.txt
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    TransparentMember correlcj's Avatar
    Join Date
    Jun 2002
    Posts
    378

    hello hammer

    I did what you said and my dos prompt replied as:
    not recognized as an internal or external command, operable program or batch file.
    What up with that?
    "Be formless, shapeless, like water... You put water into a cup, it becomes the cup, you put water into a bottle, it becomes the bottle, you put it in a teapot, it becomes the teapot... Now water can flow, or it can crash, be water my friend."
    -Bruce Lee

  4. #4
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    As long as the program is compiled, and does actually exist as an exe in the current directory, your error message probably just means your path isn't setup correctly. Although, on my Win98, the OS searches the current directory by default anyway.

    You can always change the path to include the current directory by doing:
    >PATH=.;"%PATH%"
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  5. #5
    TransparentMember correlcj's Avatar
    Join Date
    Jun 2002
    Posts
    378

    hammer time!

    I think thats my problem is that its not an .exe. So how would i go about making it one hammer!
    hammer time!
    "Be formless, shapeless, like water... You put water into a cup, it becomes the cup, you put water into a bottle, it becomes the bottle, you put it in a teapot, it becomes the teapot... Now water can flow, or it can crash, be water my friend."
    -Bruce Lee

  6. #6
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >So how would i go about making it one hammer!
    I'm not hammer, but it might help to compile and link your program into an executable. Then just run it with a redirection from the command line as Hammer suggested.

    -Prelude
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed