Shadow2531
[H]ard|Gawd
- Joined
- Jun 13, 2003
- Messages
- 1,670
Thanks.
Yeh, basically, since wchar_t is a 2byte type and some characters might be 3 or 4 bytes, what I really need to do is just use a fixed 4 byte type like:
For something like this, I wouldn't mind using 4 btye chars.
(This isn't super important or anything. I'm just exploring the possibility of supporting unicode paths.)
Yeh, basically, since wchar_t is a 2byte type and some characters might be 3 or 4 bytes, what I really need to do is just use a fixed 4 byte type like:
Code:
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
inline 32bit_ustring generatePath( const 32bit_uchar* p, const 32bit_ustring& file) {
const 32bit_ustring s( p );
if ( s.find(32bit_U"/") != 32bit_ustring::npos) {
return s.substr( 0, s.rfind( 32bit_U"/" ) ) + 32bit_U"/" + file;
} else if ( s.find(32bit_U"\\") != 32bit_ustring::npos ) {
return s.substr( 0, s.rfind( 32bit_U"\\" ) ) + 32bit_U"\\" + file;
} else {
return file;
}
}
int 32bit_umain(int argc, 32bit_uchar** argv) {
if ( argc < 1 ) {
return 1;
}
const 32bit_ustring path( generatePath( argv[0], 32bit_U"file.txt" ) );
32bit_ifstream in( path.32bit_uc.str() );
}
For something like this, I wouldn't mind using 4 btye chars.
(This isn't super important or anything. I'm just exploring the possibility of supporting unicode paths.)