本人初学C,在文件操作过程中由于反斜杠\是换码操作符,所以在包含文件路径的字符串初始化过程中若含有反斜杠\,编译就会提出警告并忽略掉反斜杠\,若象下面的main程序那样给*arg[2]进行初始化,在执行过程中就会出现图一那样的错误结果CXX0030: Error: expression cannot be evaluated,但文件还是能打开,请教大家,带有路径的文件字符串应该怎样写?这样写法恐怕不对吧!
#include <iostream>int main()
{
  const char *arg[2] ={"f:/document.doc","f:/documentb.doc"};
  FILE *inFile = 0;
  FILE *outFile = 0;
  inFile = fopen(arg[0], "rb");
  if (inFile == 0)
  std::cout << "Can not open input file \n";
  
  outFile = fopen(arg[1], "wb+");
  if (outFile == 0)
  std::cout << "Can not open output file \n";
  
  return 0;
}