推介:| Web Hosting | 外賣系統 | Server colocation | Web Shop System | Makeup course |

查看完整版本: 請留意以下的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

[quote]原帖由 [i]jayzhou_2046[/i] 於 2008-4-14 10:40 發表
該是wsprintf吧! [/quote]


終於成功!!!
不過如果將以上的程式改為用Java會不會又成功呢??

sgjiangjiang 2008-4-16 22:14

直接該JavaScript肯定不行。你用的CRT
頁: [1]
查看完整版本: 請留意以下的C語言程式