⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 blockwr.c

📁 操作系统简单的登入程序
💻 C
字号:
#include <stdio.h>#include "filesys.h"void blockwrite(char* txt,struct inode* inodei );char* blockread(struct inode* inodei );void blockwrite(char* txt,struct inode* inodei ){	int i,count;		char flag='1';		char buff[BLOCKSIZE];	count=strlen(txt);	fd=fopen("filesystem","r+");	for(i=0;i<inodei->di_size;i++)	{		strncpy(buff,txt+i*(BLOCKSIZE),BLOCKSIZE);		fseek(fd,BLOCKSIZE*(inodei->di_addr[i]),SEEK_SET);		fwrite(buff,sizeof(char),BLOCKSIZE,fd);	}	fclose(fd);}char* blockread(struct inode* inodei ){	char* txt;		int i;		char buff[BLOCKSIZE];		txt=(char*)malloc(sizeof(char)*BLOCKSIZE*(inodei->di_size));	fd=fopen("filesystem","r+");		for(i=0;i<inodei->di_size;i++)	{		fseek(fd,BLOCKSIZE*(inodei->di_addr[i]),SEEK_SET);		fread(txt+i*BLOCKSIZE,sizeof(char),BLOCKSIZE,fd);		}	fclose(fd);	return txt;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -