Computer Science Canada

MinGW - Trouble With File Input and Output

Author:  nike52 [ Mon Jun 30, 2008 1:16 pm ]
Post subject:  MinGW - Trouble With File Input and Output

Hey Smile

I installed MinGW.
When I compile on cmdline with g++ text.cpp, it works, an 'a' file appears. When I used the command ./a.out < input.txt for input and output in cmdline, the cmdline says '.' is not recognized as an internal or external command, operable file, or batch file.

Can you guys tell me what's wrong ?

Author:  apomb [ Mon Jun 30, 2008 1:39 pm ]
Post subject:  RE:MinGW - Trouble With File Input and Output

"./a.out" is a unix command, first of all. you cant run unix commands in windows unless you're using cygwin or something.

in order to compile and run files in windows, you compile and link using
code:
gcc -o hello hello.c
alternatively, you could do it in two steps:
code:
g++ -c hello.cpp
g++ -o hello hello.o

Author:  nike52 [ Mon Jun 30, 2008 2:44 pm ]
Post subject:  Re: MinGW - Trouble With File Input and Output

Oh. So that's what I was doing wrong. Ok. Thx alot apomb ! Very Happy


: