Board logo

標題: [疑難] 請留意以下的C語言程式 [打印本頁]

作者: 花之慶次    時間: 2008-4-13 22:38     標題: 請留意以下的C語言程式

#include<Windows.h>
#include<string>
int main(int argc, char*argv[])
{
    char Path[255];
    char FileName[255];
    char Data[512]="---------------------by 花之慶次---------------------------\r\n--------http://www.xocat.com--------";
    for(int i=0; i<10; i++)
    {
            GetWindowsDirectory(Path, sizeof(Path));
            wsprint(FileName,"\\%d.txt",i);
            strcat(Path,FileName);
            HANDLE hFile;
            hFile=CreateFile(Path, GENERIC_WRITE,0,NULL, CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
            if(hFile==INVALID_HANDLE_VALUE)
            {
                                           continue;
                                           }
                                           DWORD dwWrite;
                                           WriteFile(hFile, &Data, strlen(Data), &dwWrite, NULL);
                                           CloseHandle(hFile);
                                           memset(Path, 0x00,255);
                                           memset(FileName, 0x00,255);
    }                                                                     
    return 0;
}


其中這個程式好像出現了問題:
wsprint(FileName,"\\%d.txt",i);
其內容如下:
In function'int main(int, char**)';
'wsprint'undeclared(first use this function)
Each undeclared identifier is reported only once for each function it appears in.)

那我應該怎麼辦???

本篇文章来源于 黑客手册技术论坛
原文链接:http://nohack.cn/bbs/thread-75958-1-1.html
作者: jayzhou_2046    時間: 2008-4-14 10:40

該是wsprintf吧!
作者: simpo    時間: 2008-4-14 20:45

Well, there are many reference and learning material online
作者: 花之慶次    時間: 2008-4-14 21:19

引用:
原帖由 jayzhou_2046 於 2008-4-14 10:40 發表
該是wsprintf吧!
終於成功!!!
不過如果將以上的程式改為用Java會不會又成功呢??
作者: sgjiangjiang    時間: 2008-4-16 22:14

直接該JavaScript肯定不行。你用的CRT




歡迎光臨 香港 Xocat Forum 討論區 (http://p.xocat.com/p/) Powered by Discuz! 6.0.0