TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
C NewBee
NA
5
3.1k
Read data from a file and Write a set of X lines for Y times until end of data
Jan 13 2012 4:43 PM
I'm trying to read data from a file and write a set of x lines for y times until the end of the data file. For example:
This is my data file:
line 1
line 2
line 3
line 4
line 5
line 6
line 7
line 8
line 9
line 10
line 11
line 12
...
I want to read in line 1-9 and write this to a file 27 times, then read line 9-18 and write this to the same file for 27 times. My finished file should look something like:
line 1
line 2
line 3
line 4
line 5
line 6
line 7
line 8
line 9
...x27 times
line 10
...
line 18
...x27 times
My current code will write the first 9 lines for 27 times, but I'm not quite sure how to go about reading from 10-18 again. Please help! Any hint or suggestion is appreciated.
Attachment:
program.zip
Reply
Answers (
4
)
How to read the contents of Microsoft word document e.g Resume
Linear search Algorithm & its complexity.