I have to read from input file (which contains strings and integers) only integers, rearrange them to descending order and write to output file.
How should I do this?
koitfm 0 Newbie Poster
Recommended Answers
Jump to PostOr
use fgets() to read the file line by line.
test each character to see it they are all digits
if all digits, copy the line to an array to be sorted and output.There is no need to convert the numbers to ints although it might make the …
Jump to Postfflush(stdin) -- See this
getch() -- See this
while (!feof(F1)) --
All 8 Replies
abhimanipal 91 Master Poster
jephthah 1,888 Posting Maven
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
koitfm 0 Newbie Poster
abhimanipal 91 Master Poster
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
BestJewSinceJC commented: Good help to the OP +5
koitfm 0 Newbie Poster
jephthah 1,888 Posting Maven
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.