首页 > 其他 > 详细

VC读取文件内容

时间:2015-01-19 22:16:55      阅读:330      评论:0      收藏:0      [点我收藏+]
// 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;
}

  

VC读取文件内容

原文:http://www.cnblogs.com/killbit/p/4234710.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!