16,471
社区成员
发帖
与我相关
我的任务
分享
//.h
calss Proj
{
functionA();
functionB();
}
//.cpp
functionB()
{
CStdioFile file;
file.Open();
...;
file.Close();
}
functionA()
{
...;
while(...)
{
functionB();
}
}
extern "C" int WINAPI
_tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPTSTR lpCmdLine, int nCmdShow)
{
// call shared/exported WinMain
return AfxWinMain(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
}
//.cpp
static CStdioFile g_file;
functionB()
{
//CStdioFile& file = g_file;
//file.Open();
...;
//file.Close();
}
functionA()
{
...;
g_file.Open();
while(...)
{
functionB();
}
g_file.Close();
}