lab9.c

来自「ALL LINUX LAB PROGRAM MIT MANIPAL 2008-0」· C语言 代码 · 共 54 行

C
54
字号
#include<stdio.h>#include<fcntl.h>main(){	int fd,count=-1,f=0,pos;	char c;	char fname[20];	printf("Enter file name :");	scanf("%s",fname);							fd=open(fname,0);			if(fd<0)				printf("Cannot Open file not exists");			else			{	printf("Enter postion :");				scanf("%d",&pos);				printf(" Original data:");				while((read(fd,&c,1))!=0)					putchar(c);close(fd);fd=open(fname,0);				while((read(fd,&c,1))!=0)				{					count++;					if(count>=pos)					{						f=1;						printf("%c",c);					}				}				if(f!=1)					printf("Invalid position");				close(fd);			}				}			

⌨️ 快捷键说明

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