Recent update: 2008-3-11
300 byte By
msdn at 2008-3-11
TC3.0如何调用DOS命令(Dir之类)
我调试下来屏幕没有显示目录,不知道是什么原因?请大家帮忙看看,谢谢。
#include <iostream.h>
#include <stdio.h>
#include <conio.h>
#include <process.h>
#include <dir.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
void main(void)
{
system("dir d:\\");
getch();
}
网上抄了一个例子也失败了,将返回值赋给变量为-1,不知道是否和系统有...
SSI ļʱ
35 byte By
msdn at 2008-3-7
string的内存是16为单位进行扩充的,如何改为以32进行扩充?
SSI ļʱ
34 byte By
msdn at 2008-2-21
大侠,急救~怎么在基于对话框的程序里加菜单。急救~~(VC++)
300 byte By
msdn at 2007-11-19
晕呀,我在一个动态链接库中用__declspec(dllexport)导出一个类,但是,在这个类中使用了vector,string等,编译是通过了,但是有连接STL错误的警告信息,在外部也可以使用这个类,但是到使用vector的任何方法的时候都回错误.如果不导出__declspec(dllexport)则就没有任何警告信息.晕呀,我哪里错了呢?希望高手指导呀.
struct __declspec(dllexport) EventType
{
int m_iTime;
stringm_sData;
};
warning C4251: “EventType::...
300 byte By
msdn at 2007-11-17
我写了一端程序为什么接收完数据后显示 ERROR :ACCESS VIOLATION 的错误?
//acceptor.h
#ifndef __ACCEPTOR__H
#define __ACCEPTOR__H
#include "header.h"
#include "BufferManager.h"
#include "ReadData.h"
class Acceptor : public ACE_Event_Handler
{
public:
Acceptor( BufferManager * );
virtual ~Acceptor();
void open( ACE_INET_...
300 byte By
msdn at 2007-10-25
前几天,我尝试在CListCtrl中映射HDN_BEGINTRACK这个WM_NOTIFY消息。
轻松的用ClassWizard建立了消息映射,几秒中完成了所有工作之后发生的事情却让我很长时间轻松不起来了。
消息根本映射不上!!
BEGIN_MESSAGE_MAP(CPrevList, CListCtrl)
//{{AFX_MSG_MAP(CPrevList)
ON_NOTIFY_REFLECT(HDN_BEGINTRACK, OnBegintrack)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void CPrevList::OnB...
20 byte By
jeff at 2007-10-25
梦幻西游如何最快升级或很多经验值的修改器
22 byte By
无所谓 at 2007-10-25
错误是这样的:srawning c1.exe
43 byte By
msdn at 2007-9-26
如: demo.exe -d "dfsdf" , 将子串"dfsdf"传入程序中
151 byte By
msdn at 2007-9-26
如题,我要在HP-UN上编译一个64位的动态链接库,32位的我已经编译并可以应用,使用的方法是:
cc +z -c test.c
ld -b -o test.sl test.o
请问我要加什么参数才能把它编译成64位的模式?因为32所能引用的内存空间不够使用。
小弟在此谢过了!
195 byte By
msdn at 2007-9-26
公司最近要用ACE开发一个项目。功能差不多就如一个ftp服务器。在控制台下按照ace的例子作一些修改都没问题。
但由于本项目要作一个如flashget一样的窗口控制界面,本人几经周折,现在的程序还是有些问题。
本人高分求一个ACE作服务器端的窗口实例。内容主要是窗口能于ACE后台的线程通讯。具体的业务可以不计。谢谢了!
本人邮箱为: jianhe575@yahoo.com.cn
梦幻西游最快的升级方法或经验值很多的修改器请发送到yujiafeng@.163.com
4 byte By
msdn at 2007-8-23
同上
149 byte By
msdn at 2007-8-23
我用的gcc是3.3.3,用man 查帮助也有-m64这个选项,但是照google上搜的总编译不成功,用的命令是这样的:gcc -m64 -c FtpUnixClient.cpp
单总是报错:cc1plus: error: invalid option `64v`/`v
有人知道是怎么回事吗?
5 byte By
msdn at 2007-8-23
rt!
300 byte By
msdn at 2007-8-14
....
ofstream out;
ifstream int;
...
string linecnt;
int linecount=0;
while(getline(in,linebuf))
{
linecnt="";
linecount++;
if(!linebuf.empty())
{
linecnt="\t\t***Line "+static_cast<char>(linecount)+"***";
out.wri...
300 byte By
msdn at 2007-8-14
以前一直做BCB和DELPHI,比较习惯于AnsiStirng这样的懒汉字符串类。刚刚开始接触STD,所以特意在最近的项目中尽量用STD,但是std::string用的我很不顺手,特意小声问问,请大虾们指教。
问:
std::string提供了compare(),find(),assign(),及迭代器函数,还有dec,hex等数制变化等,但是有没有提供各种数据类型与它之间的变换函数呢?就象BCB里的IntToStr(),TryStrToInt(),TryStrToFloat(),TDate.DateString()?
我觉得std::string最让我头疼的就是类型...
98 byte By
msdn at 2007-8-14
各位stl方面的高手,本人刚学了stl的入门教材,接下来对stl进一步的学习应该看什么书呢?比如说,讲一些stl实际运用的,或者加深对stl认识的,请推荐书籍或网站之类的,在下在此先谢过了:)
220 byte By
msdn at 2007-8-14
void main()
{
int si=new int();
call subFunction();
delete si;
}
subFunction()
{
int s=new int();
//some operator
delete s;
}
我问一下:这个子程序subFunction里面有没有必要使用delete?我觉得子程序被执行后自动会deallocate memory,没有必要使用delete,是这样吗?
300 byte By
msdn at 2007-8-14
[以下代码用于说明问题,可能有错误]
比如:
class Point {
public:
Point(_x, _y) : x(_x), y(_y) {}
int x, y;
};
void main() {
std::list<Point> PointList;
for (int i = 0; i < 30; i++)
Point p(i, i+100);
PointList.push_back(p);
}
//问题: 怎么样用泛型算法找出PointList x=22 的那个Point对象.
// 条件: 要求 1.只用标库的...
300 byte By
msdn at 2007-8-14
/* The following code example is taken from the book
* "The C++ Standard Library - A Tutorial and Reference"
* by Nicolai M. Josuttis, Addison-Wesley, 1999
*
* (C) Copyright Nicolai M. Josuttis 1999.
* Permission to copy, use, modify, sell and distribute this software
* is granted provided th...
241 byte By
msdn at 2007-8-14
在编译和连接的时候正常,在运行的时候:
the instruction at "0x0041ea26" referenced memory at "0x00000d008".the memory could not be "read".
碰到很多次,谢谢有经验的大哥介绍一下。
平台:visual studio .net 2003 english version,windows 2k3 english version,win32 project,unmanaged code.
300 byte By
msdn at 2007-8-14
今天开始正式学习stl,看e文的同时顺便也把它翻译过来,为人民服务,希望共同进步。
如果翻译的不好请同志们不要难过,更不要扔砖头,扔鸡蛋则多多宜善,收集当早餐。:)
译文本人会通读几遍,语句努力保持通顺,可能在理解上会有些问题,希望各位同志不吝赐教。基本上如果时间允许的话会每天一篇,希望大家能支持我,努力把sgi全都翻译过来。
声明:为了不产生关键字差别误会,那些主要都容器、模板等关键字都以原英文表示,前几节不作修改,以后用原文表示。
如果每节一帖的话,到后来帖数的量会大量,因此及时调整把它们整合起来。
-----------------------------------------...
41 byte By
msdn at 2007-8-14
如上,想在读取文件的时候 对>>运算符 只是对v`/`v\nv`/`v 做反应
300 byte By
msdn at 2007-8-14
程序如下:编译环境是vc6.0。标准库是VC6自带的那个 P.J. Plauger 1995年写的那个。
#include <IOSTREAM>
#include <ITERATOR>
#include <STRING>
#include <FSTREAM>
#include <VECTOR>
#include <algorithm>
using namespace std;
int main(int argc, char* argv[])
{
string from,to;
cin>>from>>to;
ifstream is(from.c_str());
istream_it...
300 byte By
msdn at 2007-8-14
1、这个输入就是不结束,我可是按照书上的代码打的?
#include <iostream>
#include <iterator>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
istream_iterator<string> is(cin);
istream_iterator<string> eof;
vector<string> text;
copy(is, eof, back_inserter(text...
253 byte By
msdn at 2007-8-14
#include <map>
#include <string>
#include <iostream>
using namespace std;
int main()
{
map<string,int> m;
string s;
while(cin>>s){
m[s]++;
}
map<string,int>::iterator p;
for(p=m.begin();p<m.end();p++)
cout<<p->first<<"\t"<<p->second<<endl;
return 0;
}
79 byte By
msdn at 2007-8-14
我用STL已经月余,目前对其容器类、算法应用已经较纯熟。想进一步深入应用STL,比如应用stl时,感觉其string的功能还是赶不上CString功能全。
300 byte By
msdn at 2007-8-14
程序如下:编译环境是vc6.0。标准库是VC6自带的那个 P.J. Plauger 1995年写的那个。
#include <IOSTREAM>
#include <ITERATOR>
#include <STRING>
#include <FSTREAM>
#include <VECTOR>
#include <algorithm>
using namespace std;
int main(int argc, char* argv[])
{
string from,to;
cin>>from>>to;
ifstream is(from.c_str());
istream_it...
300 byte By
msdn at 2007-8-14
#include<stdio.h>
#include<stdlib.h>
typedef struct{
char *base;
char *top;
int stacksize;
}SqStack;
void InitStack(SqStack s){
s.base=(char *)malloc(100 * sizeof(char));
if(!s.base)exit(0);
s.top=s.base;
s.stacksize=100;
}
viod Push(SqStack s,char e){
*s.top++=e;
printf("%c",e);
}
viod Po...
51 byte By
msdn at 2007-8-14
我想用boost的regex匹配这样的字符串
(a,b)
但不想让找到的字符串包含括号,怎么做?
300 byte By
msdn at 2007-8-14
BCB6中使用STL的stack.top()出错
while(!stack1.empty())
{
stack1.pop();
const TPoint &ppt=stack1.top();
this->LastX = ppt.x; //执行到这里出错
this->LastY = ppt.y;
if(stack2connect()==true)return true;
}
TPoint是一个struct,保存了一个点的x、y坐标。...
299 byte By
msdn at 2007-8-14
//MyClass.h
#ifndef _MY_CLASS_H
#define _MY_CLASS_H
class MyClass
{
public:
MyClass(T a=0,T b=0) ;
void get(T & a,T & b);
private:
T an;
T bn;
};
#endif
//MyClass.cpp
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "MyClass.h"
template <class T>
300 byte By
msdn at 2007-8-14
最近迷上了Plauger大叔的STL库。。一边使用一边trace它的源代码,可是发现了一个问题是关于allocator中的rebind,其定义如下:
template
class allocator
: public _Allocator_base<_Ty>
{
//....other code...
template
struct rebind
{ // convert an allocator<_Ty> to an allocator <_Other>
typedef allocator<_Other> other;
};
//....other code...
...
140 byte By
msdn at 2007-8-14
return能不能强制类型转换?!
int alter(double x)
{
return x;
}
能不能得到int 的结果??
原函数:
int alter(double x)
{ int y=x;
return y;
}
不好意思,我是新手,问题弱智不要笑我:)
300 byte By
msdn at 2007-8-14
我按原书的例子写上的,怎么总报错,都是连接的KERNEL32.LIB、USER32.LIB和GDI32.LI
B啊,程序如下:(很简单的)
/*------------------------------------------------------------------
HelloMsg.c -- Displays "Hello, Windows 98!" in a message box
(c) Charles Petzold, 1998
--------------------------------------------------------------------*/
...
181 byte By
msdn at 2007-8-14
list<string> sl;
sl.push_back("aaa");
sl.push_back("bbb");
sl.push_back("ccc");
list<string>::iterator node = sl.begin();
sl.erase(sl.begin());
node++;
cout<< *node <<endl;
最后一句出错
300 byte By
msdn at 2007-8-14
#include <tchar.h>
#include <iostream>
#include <string>
#include <list>
#
int _tmain(int argc, _TCHAR* argv[])
{
list<string> Malkshakes;
Milkshakes.push_back("Chocolate");
Milkshakes.push_back("Strawberry");
Milkshakes.push_front("Lime");
Milkshakes.push_front("Vanilla");
return 0;
}
#inc...
5 byte By
msdn at 2007-8-14
谢谢!
300 byte By
msdn at 2007-8-14
代码如下:
#include<iostream>
using namespace std;
void main()
{
char sa[9];
sa[0] = 0x09;
double da = 89.334;
char* sa1 =reinterpret_cast<char*>(&sa);
strcat(sa,sa1);
memcpy(&da, sa+1,sizeof(double));
cout<<da;
return;
}
输出结果:4.44659e-323
不是我想要的原来的da = 89.334
我那里出错了,小弟不明白!谁帮我?
不要告诉我通过把do...
215 byte By
msdn at 2007-8-14
seek.obj : error LNK2001: unresolved external symbol _fsync
seek.obj : error LNK2001: unresolved external symbol _ftruncate
seek.obj : error LNK2001: unresolved external symbol _mkstemp
那位大人给个根本的解决方法,,,小弟感激不尽....
300 byte By
msdn at 2007-8-14
一个如下定义的map
typedef std::map <int, Peer_Inst*> Peer_Map;
Peer_Inst是我定义的类
通过一个函数
find_user(int n_ID)
{
Peer_Map::iterator
iter_ = this->peer_map_.find(n_ID);
if (iter_ != peer_map_.end())
{
return iter_->second;
}
return 0;
}
找到一个保存在map中的元素
比如
Peer_Inst* inst_ = find_user(12);
找到一个index是1...
129 byte By
msdn at 2007-8-14
比如:
typedef std::vector<TRule*> TArray;
TArray* FArrays;
这样可以得到对象值,TRule* Rule = (*FArrays)[No];
有办法根据No直接从FArrays删除Rule对象吗?
19 byte By
msdn at 2007-8-14
就是将"00011"转化成 3之类
34 byte By
msdn at 2007-8-14
想深入学习c,但是找不到标准c库,哪位大哥帮帮忙,最好有电子书籍
74 byte By
msdn at 2007-8-14
有很多对Unicode支持的以w开头的字符串函数,但我对stl如何提供对unicode支持不太清楚。string类直接支持unicode字符吗?
300 byte By
msdn at 2007-8-14
如何在所有全局变量初始化前执行某函数,并在调用所有全局变量析构之后调用某函数。
我想做一个内存管理器,从底层代替 crt 的 malloc 和 free。
现在已经可以成功替换 malloc 和 free 的函数定义,并用自己的函数代替。但问题是,我需要在自己的函数中访问某些管理数据,而在这些数据被释放后,自己的 malloc 和 free 仍然有可能被其它程序调用(例如全局类的析构函数中),造成错误。那么,我必须让这些数据在 crt 初始化其它所有变量之前首先进行初始化,并在他们全部释放之后再进行释放。可是,我哪怕将这些数据放到静态全局变量中都没有办法保证这点。我又研究了一下 crt 的...
49 byte By
msdn at 2007-8-14
例如:
整数 1256 拆分成1 2 5 6
Sum=1+2+5+6=14
55 byte By
msdn at 2007-8-14
用VC++6编译"int class;",class作为一个变量用。
请问该如何设置vc++6的编译参数?
209 byte By
msdn at 2007-8-14
Linking...
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/q.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
q.exe - 2 error(s), 0 warning(s)