#include<stdio.h>
#include<stdlib.h>
#include<string.h>
void main(int argc,char *argv[])
{
char word[100];
int count=1;
FILE *fp;
fp = fopen(argv[3],"r");
while(fscanf(fp,"%[^\n]\n",word)!=EOF)
{
for(count=1;count<(strlen(word)-1);count++)
{
if(count >= atoi(argv[1]) && count <= atoi(argv[2]))
{
printf("%c",word[count]);
}
}
printf("\n");
}
fclose(fp);
}
OUTPUT :
cc cut-b.c
./a.out 2 5 text.txt
WARNING : "- " NOT USED AS DELIMITER.
#include<stdlib.h>
#include<string.h>
void main(int argc,char *argv[])
{
char word[100];
int count=1;
FILE *fp;
fp = fopen(argv[3],"r");
while(fscanf(fp,"%[^\n]\n",word)!=EOF)
{
for(count=1;count<(strlen(word)-1);count++)
{
if(count >= atoi(argv[1]) && count <= atoi(argv[2]))
{
printf("%c",word[count]);
}
}
printf("\n");
}
fclose(fp);
}
OUTPUT :
cc cut-b.c
./a.out 2 5 text.txt
WARNING : "- " NOT USED AS DELIMITER.
Comments
Post a Comment