在dev-c++下进行交互式的文件操作,如何总是不行啊

在dev-c++上进行交互式的文件操作,怎么总是不行啊?
在dev-c++上进行交互式的文件操作,总是没法运行,只有在CMD下才可以运行并实现文件操作。
为什么会这样呢?

[code=C/C++][/code]

#include <stdio.h>
#include <stdlib.h> //为了调用exit() 
#include <ctype.h>
#define len 100
int main(void)
{
  FILE *in,*copy;  
  char ch,str1[len],str2[len];  
   
  printf("please input the name of the source file:\n");  
  gets(str1);  
  printf("please input the name of the copy file :\n");  
  gets(str2);  
  if((in=fopen(str1,"r"))==NULL) //打开源文件,得到文本流 
  {
  printf("I couldn't open the file %s\n",str1);  
  exit(1);  
  }
  if((copy=fopen(str2,"w"))==NULL) //打开复制文件,以供写入 
  {
  printf("Can't open the copy file %s.\n",str2);
  exit(2);  
  }
  
  while((ch=getc(in))!=EOF)
  {
  if(ch<='z'&&ch>='a')  
  ch=toupper(ch);
  putc(ch,copy);
  }
  fclose(in); //文件操作结束后,关闭文件
  fclose(copy);  
  system("pause");  
  return 0;  
}

------解决方案--------------------
C/C++ code
#INCLUDE <STDIO.H>
#INCLUDE <STDLIB.H>
#INCLUDE <CTYPE.H>
#DEFINE LEN 100
INT MAIN()
{
    FILE* IN, *COPY;
    CHAR CH, STR1[LEN], STR2[LEN];

    PRINTF("PLEASE INPUT THE NAME OF THE SOURCE FILE:\N");
    GETS(STR1);
    PRINTF("PLEASE INPUT THE NAME OF THE COPY FILE :\N");
    GETS(STR2);
    IF ((IN = FOPEN(STR1, "R")) == NULL) { //打开源文件,得到文本流
        PRINTF("I COULDN'T OPEN THE FILE %S\N", STR1);
        EXIT(1);
    }
    IF ((COPY = FOPEN(STR2, "W")) == NULL) { //打开复制文件,以供写入
        PRINTF("CAN'T OPEN THE COPY FILE %S.\N", STR2);
        EXIT(2);
    }

    WHILE ((CH = GETC(IN)) != EOF) {
        IF (CH <= 'Z' && CH >= 'A')
            CH = TOUPPER(CH);
        PUTC(CH, COPY);
    }
    FCLOSE(IN); //文件操作结束后,关闭文件
    FCLOSE(COPY);
    RETURN 0;
}