函数返回的指针问题,帮帮我解释一下 你应该好好看一下msdngmtime, mktime, and localtime all use a single statically allocated tm structure for the conversion. Each call to one of these routines destroys the result of the previous call. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 gmtime, mktime, and localtime all use a single statically allocated tm structure for the conversion的意思是tm是静态局部变量吗? time_t current_time; // 分配在栈中time_t *current_time = new time_t; // 在分配堆中, use delete to free the resource 可是我看了源代码,不是这样的,是reg型的 struct tm *datetime; 是说明datetime是一个指向struct tm的指针了,后面的&datatime的意思是指向指针的指针,一个例子可以说明,象COM中的接口的QueryInterface函数就是需要传递指向指针的指针作为参数。在同一作用域中new 要和 free 匹配。这就象{}一样啊。关于内存管理你应该好好看看MSDN,这和Windows操作系统有关。 这个结构体指针没有给它初始化内存空间,好像不能free掉吧 关于托盘气泡的问题? 关于如何构造socket消息体 137端口问题 关于P2P的棘手问题,高手请进。 谢谢大家了,能不能运汉语标注一下,不好意思刚入门 msagent例子更新 在VC++6.0下,TCP通信客户端和服务端相互发送数据包,如何记录接收数据包的时间? 对话框多选 文件传输如何控制状态?暂停,恢复? WIN7 下 服务中 CreateProcess的问题 VC++中如何将字符串转换成URL encode的? 你知不知道做一个类,不从CWnd中派生,而从CCmdTarget中派生出来,如何向它发送消息。
的意思是tm是静态局部变量吗?
time_t *current_time = new time_t; // 在分配堆中, use delete to free the resource
在同一作用域中new 要和 free 匹配。这就象{}一样啊。关于内存管理你应该好好看看MSDN,这和Windows操作系统有关。