Skip to content

Commit 3dfc95f

Browse files
committed
fail properly
1 parent cf3ad5c commit 3dfc95f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

bmp2spessart/main.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
void convert(const std::string& path) {
1111
auto* const file{ fopen(path.c_str(), "rb") };
1212
if (!file) {
13-
const auto message{ "File not found:" + path };
13+
const auto message{ "File not found: " + path };
1414
throw std::exception{message.c_str()};
1515
}
1616

@@ -118,19 +118,19 @@ int main(int argc, char** argv) {
118118
else if (argc == 2) {
119119
path = argv[1];
120120
}
121-
else {
122-
std::cerr << "Unsupported launch: try bmp2spessart <file>" << std::endl;
123-
return 1;
124-
}
125121

122+
if (path.empty()) {
123+
std::cerr << "Unsupported launch: try bmp2spessart <file>" << std::endl;
124+
} else
126125
try {
127126
convert(path);
128127
}
129128
catch (const std::exception& e) {
130-
std::cerr << e.what();
131-
return 1;
129+
std::cerr << e.what() << std::endl;
132130
}
133-
131+
132+
std::cout << "Done, press any key to exit";
133+
system("pause");
134134
return 0;
135135

136136
}

0 commit comments

Comments
 (0)