typedef deque<char*> ANSI_DEQUE;
ANSI_DEQUE ansi_deque;
for (int i = 0;i < 5 ; i++)
{
char szBuf[MAX_PATH] = {0};
sprintf_s(szBuf,MAX_PATH,"%s_%d","small",i);
ansi_deque.push_back(szBuf);
}
for (size_t i = 0; i < ansi_deque.size();i++)
{
cout<<ansi_deque[i]<<endl;
}为什么输出的都是small_4我要的是
small_0
..
small_4
解决方案 »
- 基于POP3协议的电子邮件程序
- accept老是返回-1
- wtl的CComboBox为何输入中文显示的是乱码?
- 访问他人机器时需要登陆名和密码,如何通过编程实现??
- the classwizard entry for the class "CT1View" is missing or corrupt in ths classwizard database file "d:\vc\t1\t1.clw";
- 请问如何存取IP地址
- Ariesman(超然) 啥也别说了
- &与 *的区别
- 怎么使用Polygon绘制多边形?(急)
- MFC串口通信接收数据停止
- 关于ADO连接oracle数据库的问题
- 求助:VC 操作WORD 设置表格为根据内容自动调整
你deque存的是指针啊,大哥。
char * szBuf = (char *)malloc(MAX_PATH);这样保证有用。记得在最后deque的时候free每个指针即可
char * szBuf = (char *)malloc(MAX_PATH);
替换
char szBuf[MAX_PATH] = {0};