问题描述
- 命令行参数怎么写啊,这个错误找了好久也解决不了
-
#include
#include
#include
#include
using namespace std;int _tmain(int argc, TCHAR* argv[])
{TCHAR * srcfile = NULL; TCHAR * tgtfile = NULL; ifstream src; ofstream tgt; string sd; for(int i = 1;i < argc; ++i) { cout<<"abc"; if(_tcscmp(argv[i], _T("-src"))==0) { srcfile = argv[++i]; cout<<"Source File Locate Sucessfullyn"; } if(_tcscmp(argv[i], _T("-tgt"))==0) { tgtfile = argv[++i]; cout<<"Target File Locate Sucessfullyn"; } continue; } src.open(srcfile,ios::in); tgt.open(tgtfile,ios::out); if(!src) cout<<"srcfile emptyn"; while(getline(src,sd)) { tgt<<sd<<endl; } src.close(); tgt.close(); return 0; }
![图片说明](http://img.ask.csdn.net/upload/201501/08/1420730932_772428.png) 求大神指点迷境,解惑啊,小弟感激不尽
解决方案
文件名中有空格么?
src.open(srcfile,ios::in);
tgt.open(tgtfile,ios::out);
在这里下断点调试下
解决方案二:
/#include "stdafx.h"
/#include
/#include
/#include
/#include
头文件
解决方案三:
错误::::::::::::::::::::::::::::::::::::::::::::::::::::
Microsoft Visual C++ Runtime Library
Debug Assertion Failed!
Program: E:Vitual 2012parameterDebugparameter.exe
File: f:ddvctoolscrt_bldself_x86crtsrcfopen.c
Line: 54
Expression: (file != NULL)
For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.
(Press Retry to debug the application)
中止(A) 重试(R) 忽略(I)
解决方案四:
要么是没有权限,要么是srcfile文件名不完整,你调试下。
解决方案五:
点中止,用编译器调试
时间: 2024-10-05 15:39:00