嗨我必須編寫一個windows api代碼,通過爲每個字符添加3來加密文件。在win API中加密文件
所以我寫了這個,現在它沒有做任何事情......我走到哪裏wronge
#include "stdafx.h"
#include <windows.h>
int _tmain(int argc, _TCHAR* argv[])
{
HANDLE filein,fileout;
filein=CreateFile
(L"d:\\test.txt",GENERIC_READ,0,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
fileout=CreateFile
(L"d:\\test.txt",GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
DWORD really; //later this will be used to store how many bytes I succeed to read
do
{
BYTE x[1024]; //the buffer the thing Im using to read in
ReadFile(filein,x,1024,&really,NULL);
for(int i=0 ; i<really ; i++)
{
x[i]= (x[i]+3) % 256;
}
DWORD really2;
WriteFile(fileout,x,really,&really2,NULL);
}while(really==1024);
CloseHandle(filein);
CloseHandle(fileout);
return 0;
}
,如果林權我怎麼能知道它的確定
哇,沒有什麼能夠激勵我去幫助他,而不僅僅是被稱爲傻子! – 2010-06-01 16:26:27
@Steven Sudit:如果那是白癡的名字,那還不錯。 – Tester101 2010-06-01 16:36:09
@Kristian:我只問是否是功課,因爲每個角色都加了三個字並不是真的加密!看起來像使用winapi編寫代碼的練習。我希望你不要生氣。 – 2010-06-01 16:39:02