【发布时间】:2013-10-09 10:05:37
【问题描述】:
我在调试这段代码时遇到以下问题:
// Croppen.cpp : Defines the entry point for the console application.
#include "stdafx.h"
#include "stdlib.h"
int i,j,c;
char hex[] = {"header.hex"},
ziel[] = {"ergebniss.bmp"},
eingabe[100];
FILE *f,*h;
int _tmain(int argc, _TCHAR* argv[])
{
{//eingabe des Orginalen Bildnamens
printf("Bitte geben sie den Bild namen ein. Maxiaml 20 Zeichen, mit '.bmp'\n");
do { scanf("%s", eingabe); } while ( getchar() != '\n' );
if ((f = fopen(eingabe,"rb")) == NULL)
{
printf("Fehler beim Öffnen von %s\n",eingabe);
system("exit");
}
}
{//header einlesen
h = fopen(hex,"wb");
for (i = 0; i < 52; i++) { putc(getc(f),h); }
}
return 0;
}
产生这个错误:
'Croppen.exe': Loaded 'C:\Windows\SysWOW64\oleaut32.dll', Symbols loaded (source information stripped).
The program '[2884] Croppen.exe: Native' has exited with code 3 (0x3).
谁能说出我的问题出在哪里?
我使用 MS VS 2010 Prof IDE。
【问题讨论】:
-
您有什么理由使用 C 风格的字符串和 C 风格的函数,例如
fopen? -
什么是
system("exit")? -
是的,它是一个开着 ca 2000 的舞会,关闭其他 E/A 突击队,如果可能的话,我不想改变它们。系统(“退出”);来自好的旧 DOS 它很容易关闭程序
-
它没有,您必须使用 exit() 代替。退出代码倾向于匹配异常退出时的操作系统错误代码,3 =“找不到路径”。很多巧合。
标签: c++ visual-c++ runtime-error visual-studio-debugging