diff options
author | Bernard Normier <bernard@zeroc.com> | 2006-06-12 14:45:01 +0000 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2006-06-12 14:45:01 +0000 |
commit | b16e7b80ddadcf142fb55a830e4361d64a387019 (patch) | |
tree | 800f38136305f9bd1896463c5e458519f37929c0 /cpp/test/IceUtil/unicode/Client.cpp | |
parent | *** empty log message *** (diff) | |
download | ice-b16e7b80ddadcf142fb55a830e4361d64a387019.tar.bz2 ice-b16e7b80ddadcf142fb55a830e4361d64a387019.tar.xz ice-b16e7b80ddadcf142fb55a830e4361d64a387019.zip |
Fixed running from other directory
Diffstat (limited to 'cpp/test/IceUtil/unicode/Client.cpp')
-rw-r--r-- | cpp/test/IceUtil/unicode/Client.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/cpp/test/IceUtil/unicode/Client.cpp b/cpp/test/IceUtil/unicode/Client.cpp index 0885af27dd8..550af036ed2 100644 --- a/cpp/test/IceUtil/unicode/Client.cpp +++ b/cpp/test/IceUtil/unicode/Client.cpp @@ -19,8 +19,21 @@ using namespace std; // converts these BOMs back and forth. // int -main(int, char**) +main(int argc, char** argv) { + string dir = ""; + + if(argc > 1) + { + dir = argv[1]; +#ifdef _WIN32 + dir += "\\"; +#else + dir += "/"; +#endif + } + + ostringstream os; os << "utf" << sizeof(wchar_t) * 8; #ifdef ICE_LITTLE_ENDIAN @@ -34,9 +47,9 @@ main(int, char**) { cout << "testing UTF-8 to wstring (" << wstringEncoding << ") conversion..."; - ifstream is("coeur.utf8"); + ifstream is((dir + "coeur.utf8").c_str()); test(is.good()); - ifstream bis(wcoeurFile.c_str(), ios_base::binary); + ifstream bis((dir + wcoeurFile).c_str(), ios_base::binary); test(bis.good()); int lineNumber = 0; @@ -94,7 +107,7 @@ main(int, char**) { cout << "wstring (" << wstringEncoding << ") to UTF-8 conversion..."; - ifstream bis(wcoeurFile.c_str(), ios_base::binary); + ifstream bis((dir + wcoeurFile).c_str(), ios_base::binary); test(bis.good()); wstring ws; @@ -123,7 +136,7 @@ main(int, char**) string s = wstringToString(ws); - ifstream nbis("coeur.utf8", ios_base::binary); + ifstream nbis((dir + "coeur.utf8").c_str(), ios_base::binary); test(nbis.good()); for(size_t i = 0; i < s.size(); ++i) |