- 488 名前:名前は開発中のものです。 mailto:sage [2018/09/07(金) 17:09:17.90 ID:stA8I9vh.net]
- 良く分からんけど、こんな感じの事がしたいの?
void LoadData( int t_Width, int t_Height, std::string t_FileName ) { int t_FileHandle = FileRead_open( t_FileName.c_str() ); int t_FileSize = FileRead_size( t_FileName.c_str() ); std::vector< std::vector< int > > t_MapDataVec; int t_LoadNum = 0; char t_Char; //マップの配列を確保 t_MapDataVec.resize( t_Height ); for( int i = 0; i < t_Height; i++ ) { t_MapDataVec[ i ].resize( t_Width ); } //正常に1文字を読み込める間、繰り返す while( ( t_Char = FileRead_getc( t_FileHandle ) ) != -1 ){ if( isdigit( t_Char ) != 0 ){ int t_Sum = 0; do{ t_Sum = ( t_Sum * 10 ) + ( t_Char - '0' ); t_Char = FileRead_getc( t_FileHandle ); }while( isdigit( t_Char ) != 0 ); t_MapDataVec[ t_LoadNum / t_Width ][ t_LoadNum % t_Width ] = t_Sum; ++t_LoadNum; } } FileRead_close( t_FileHandle ); }
|

|