#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char file1[30],a[50],s[50],n;
int j=0,k,i,len;
FILE *fp;
clrscr();
printf("enter the file path:");
gets(file1);
fp=fopen(file1,"r");
if(fp==NULL)
{
puts("file cannot be opend");
exit(0);
}
printf("\n Enter the number of characters to reverse:");
scanf("%d",&k);
n=fread(a,1,k,fp);
a[n]='\0';
len=strlen(a);
for(i=len-1;i>=0;i--)
{
s[j]=a[i];
printf("%c",s[j]);
j=j+1;
}
s[j+1]='\0';
getch();
}
#include<conio.h>
#include<string.h>
void main()
{
char file1[30],a[50],s[50],n;
int j=0,k,i,len;
FILE *fp;
clrscr();
printf("enter the file path:");
gets(file1);
fp=fopen(file1,"r");
if(fp==NULL)
{
puts("file cannot be opend");
exit(0);
}
printf("\n Enter the number of characters to reverse:");
scanf("%d",&k);
n=fread(a,1,k,fp);
a[n]='\0';
len=strlen(a);
for(i=len-1;i>=0;i--)
{
s[j]=a[i];
printf("%c",s[j]);
j=j+1;
}
s[j+1]='\0';
getch();
}
No comments:
Post a Comment