请高手帮帮忙,我没学过vc
但因目前有需要使用vc将一个文件进行加密和解密的工作
所以我参考了www.vckbase.com 里有一位先进林静的程序代码
将之改为较简单的程序
是使用vc  project 的win32 console application 撰写
希望在main 后
对一个文件加密或解密
以下是我修改后的程序
但compiler时出现以下2个错误
unresolved external symbol __endthreadex
unresolved external symbol __beginthreadex能否有专家能替我改写以下程序代码……到底哪里出错噜
谢谢// 2.cpp : Defines the entry point for the console application.#include "stdafx.h"
bool ecfile();
bool dcfile();
__int64 m_password;void main()
{
ecfile();
}bool ecfile()
{
char *data;
CFile *file;
DWORD flen; m_password=12345678;
file = new CFile;
if ( !file->Open("C:\test.txt", CFile::shareDenyNone|CFile::modeReadWrite))
{
return FALSE;
}
flen = file->GetLength();
data = new char[(int)flen]; 
file->SeekToBegin();
file->Read(data, flen); for(int i=0; i<(int)flen; i++)
{
data[i] ^= m_password;
data[i] ^= flen;                
}
file->SeekToBegin();
file->Write(data, flen);
delete[] data;                        char cpass[5] = "love";
for(int j=0; j<5; j++)
{
cpass[j] ^= m_password;
}
file->SeekToEnd();
file->Write(&cpass, 5);        
file->Close();
delete file;
return TRUE;
}
bool dcfile()
{
char *data;
CFile *file;
DWORD flen;
char love[5]; file = new CFile;
if( !file->Open("C:\test.txt", CFile::shareDenyNone|CFile::modeReadWrite))
{
return FALSE;
} flen = file->GetLength();
data = new char[(int)flen]; file->Seek(-5, CFile::end);
file->Read(&love, 5);
m_password=12345678;
for(int i=0; i<5; i++)
{
              love[i] ^= m_password;
} if(strcmp(love, "love")!=0)
{
return FALSE;
}
file->SeekToBegin();
file->Read(data, flen);
for(int j=0; j<(int)flen; j++)
{
data[j] ^= m_password;
data[j] ^= (flen-5);
}
file->SeekToBegin();
file->Write(data, flen);
file->SetLength(flen-5);     
file->Close();
delete[] data;
delete file;
return TRUE;
}

解决方案 »

  1.   

    它用了MFC,你用win32 console application 的第一步时选最后一个
    An application that supper MFC
      

  2.   

    it's say msvcrtd.dll not find...
    if i don't wat to use MFC appliccation what i must write
    please help me...thanks
      

  3.   

    you not install VC6?
    Because msvcrtd.dll is VC6's MFC Libary
      

  4.   

    http://www.codeguru.com/Cpp/W-D/doc_view/misc/article.php/c6111/
    这里有一个使用BlowFish加密算法对文档进行加密的例子