本文介绍了存储一个整数到在C的char * ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在写一些code,它返回一个整数,然后还需使用printw从ncurses库输出。然而,由于printw只需要字符*,我无法弄清楚如何输出。
I'm writing some code that returns an integer, which then needs to be outputted using printw from the ncurses library. However, since printw only takes char*, I can't figure out how to output it.
从本质上讲,是有使用printw办法一个整数存储到一个字符数组,或输出一个整数?
Essentially, is there a way to store a integer into a char array, or output an integer using printw?
推荐答案
printw()
接受为const char *
作为格式说明。你想要的是
printw()
accepts const char *
as a format specifier. What you want is
printw("%d",yournumber);
这篇关于存储一个整数到在C的char * ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!