Edd*_*223 1 c++ arrays types casting char
可能重复:
C++将int和string转换为char*
你好,我正在制作游戏,我有一个记分板.得分存储在一个int变量中,但是我用于游戏的库需要一组字符,用于为我的记分板输出文本.
那么如何将int转换为字符数组呢?
int score = 1234; // this stores the current score
dbText( 100,100, need_the_score_here_but_has_to_be_a_char_array);
// this function takes in X, Y cords and the text to output via a char array
Run Code Online (Sandbox Code Playgroud)
我正在使用的库是DarkGDK.
tyvm :)
ostringstream sout;
sout << score;
dbText(100,100, sout.str().c_str());
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
558 次 |
最近记录: |