// 读文件到内存.cpp : Defines the entry point for the console application.
// 谢谢下载,本程序属自己学习过程的笔记,发出来一是赚取积分,二是分享给初学者,注意是初学者,大神莫笑!!!
#include "stdafx.h"
#include <malloc.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
int read_file()
{
int zz,dq,pp,size,sum;
char* pfile="C:\\Windows\\notepad.exe";
FILE* fp;//定义文件指针fp
char* ptr;//返回指向被分配内存的指针
fp=fopen(pfile,"rb");//wb+ 是参数,表示既能写,又能读。
if(fp==NULL) // 如果没有文件就打印没有发现文件。
{
printf("没有发现文件!\n");
}
else
{
printf("文件已经打开了!\n");
}
{
zz=ftell (fp);//测试打开后默认文件指针在哪里,通过测试发现在文件头。
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余3页未读,立即下载