FILE *stream; CString ss;
ss = GetAppPath() + "yy\\bing" + TXT_Num + ".jpg";
if (stream = fopen(ss, "w"))
{
fwrite(buffer, sizeof(unsigned char), sizeof(buffer), stream);
fflush(stream);
fclose(stream);
}
Sleep(1500);
---------------------------
Microsoft Visual C++ Debug Library
---------------------------
Debug Error!
Module: E:\wangyoua\dll.dll
File: e:\wangyou\dhh\bc\dll\ma.cpp
Line: 4803Run-Time Check Failure #2 - Stack around the variable 'ss' was corrupted.(Press Retry to debug the application)
---------------------------
终止(A)   重试(R)   忽略(I)   
---------------------------
这个错误怎么解决

解决方案 »

  1.   

    你GetAppPath函数恐怕有问题
      

  2.   

    CString GetAppPath()
    {
    CString strPath;
    char cCurrentFilePath[255];
    int nTemp; GetModuleFileName(NULL, cCurrentFilePath, 255); strPath = cCurrentFilePath;
    nTemp = strPath.ReverseFind('\\');
    strPath = strPath.Left(nTemp+1); return strPath;
    }这个就是 不会吧~
      

  3.   


       CString ss;
        ss = GetAppPath() + "yy\\bing" + TXT_Num + ".jpg";
    改这样CString ss;
    ss.Format("%s%s%s%s", GetAppPath(), "yy\\bing", TXT_Num, ".jpg");
      

  4.   

    看看有没有函数远行声明它为stdcall的
      

  5.   

    代码不完整,其他变量出错导致代码运行到 ss 的时候错误显示出来了,ss本身是没有错误的
      

  6.   

     ss = GetAppPath() + "yy\\bing" + TXT_Num + ".jpg";
    错误在这句
    CString GetAppPath()
    {
        CString    strPath;//这个已经被析构,不能再+字符串
    }