// chopper.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <stdio.h>
#include <WinSock2.h>
#include <Windows.h>
#include <stdlib.h>
int redpwd(char* pwd)
{
FILE* fp;
if ((fp = fopen(pwd,"rb")) == NULL)//以只读方式打开
{
printf("I‘am sorry,pwd:%s not found\r\n",pwd);
return 0;
}
char buf[MAX_PATH] = {0};
int i = 0;
while (fgets(buf,MAX_PATH,fp))//循环读取字符串
{
printf("已经读取密码:%d-------->读取内容 :%s \n",++i,buf);
}
fclose(fp);//关闭文件句柄
return 0;
}
int main(int argc,char** argv)
{
if (argc < 2)
{
printf("[-]:%s READ_File\r\n",argv[0]);
return 0;
}
redpwd(argv[1]);
return 0;
}
原文:http://www.cnblogs.com/killbit/p/4234710.html