我与具有定时器,定时器一些C++代码工作运行此:全局变量
char buf[1024];
ZeroMemory(&buf, sizeof(buf));
somefunction(buf); // this put stuff into buf
otherfunction(buf); // this do stuff with buf
somefunction()做一个网络请求和的InternetReadFile()把数据在“BUF”
但是我需要能够在下次执行定时器时读取先前的buf。如何将buf存储在全局变量中并重新分配它,或者在必要时使“buf”等于先前存储的值?
你的问题中提到“的InternetReadFile()”,但你的代码只提到“otherfunction()” - 这你是什么意思? 'cpp'是指C++而不是C预处理器? – 2010-09-30 02:54:04
你在处理需要使用变量的多个线程吗? – 2010-09-30 02:55:20
远远少于上下文。 – 2010-09-30 02:58:56