answersLogoWhite

0

#include <stdio.h>

#include <stdlib.h>

void reverse(FILE * file) {

int fscanf_return_value;

char x;

/* read a char */

fscanf_return_value = fscanf(file,"%c",&x) ;

if(fscanf_return_value == EOF) { //fscanf returns EOF as the END OF FILE

return;

}

reverse(file); //Get the next char

//do something with the char e.g. print

putchar(x);

return;

}

int main(int argc, char *argv[]) {

int i;

FILE *fd;

if (argc!=2) {

printf("Usage : \n %s FILENAME\n",argv[0]);

exit(0);

}

if(!(fd=fopen(argv[1],"r"))) {

printf("Opening file error\n");

exit(1);

}

reverse(fd);

printf("\n\n\t---\tenoD - Done\t---\n");

close(fd);

exit(0);

}

.....................if u like it get ask me more

my FB ID is phani.9885120096@gmail.com.

User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions

Write a function to reverse a string and to display it?

Yes.


Write the program in Linux to find the reverse of any string?

i am sam


Write a program to implement the various operations on string such as length of string concatenation reverse of a string copy of a string to another in VB?

what is string


How do you write string in reverse through the HTML tags?

Not possible through html. Use php strrev function. For eg:


Write a Program to convert decimal number into hexadecimal no without using function and string?

This is not a question.


How to write a program in python to print the reverse of a number?

In python, type the following into a document. NOTE: Sentences following a # symbol are comments, and are not necessary for the program to run. #!/usr/bin/python #This program takes a input from a user and reverses it. number = input("Type a number: ") #This takes input from a user. a = len(number) #This finds the length of the number reverse = "" #This sets the variable reverse to an empty string. for i in number: a = a-1 #The places in a string start from 0. The last value will be the length minus 1.reverse = reverse + number[a] #Makes the number's last digit the new string's first. print("The reverse of", number, "is", reverse + ".") #prints the resulting string. This program will take any sequence of characters and reverse them. The final value is a string, but if an integer is needed, one needs only to add the line reverse = int(reverse) above the print statement. However, this will stop the program from being able to reverse strings, as it is not possible to convert a string to an integer if it is not a number.


How do you write a program using function that counts the number of vowels in a string in java language?

Use text-editor notepad++


Write a flowchart of reverse the string in c?

wefwfe


Write a program to concate the string without using strconcat function?

If you don't need to preserve the first string you could just iterate over the second string and copy each character onto the end of the first string, then return that


Write a program in c to convert a given string to lower case?

Use the tolower() function. Example: char* a = 'X'; a = tolower(a); printf("%c", a);


How do you write a program that outputs a given characters in reverse?

write the javascript code to display the reverse no. of given no. (e.g. 247 reverse of 742)


How do you Write a program in 'c' language which accepts int numbers from the users print its reverse number x function which return value?

question clarity