By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,194 Members | 817 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,194 IT Pros & Developers. It's quick & easy.

Read bulk data from file

P: 1
Can anyone suggest me , how to read ' N ' lines (e.g 100 Lines) of data from a input file in a single read.

Input file contains data with \n in each line.Since the data in each line is not of fixed size , im facing problem in reading 100 full lines of data.
Feb 20 '07 #1
Share this Question
Share on Google+
1 Reply


sicarie
Expert Mod 2.5K+
P: 4,677
Can anyone suggest me , how to read ' N ' lines (e.g 100 Lines) of data from a input file in a single read.

Input file contains data with \n in each line.Since the data in each line is not of fixed size , im facing problem in reading 100 full lines of data.
I would suggest looking through the libraries here (link to getline() ). I think you might want getline - I think that will be able to pull everything in that you want - just make sure you declare enough memory to store it.

Are the '\n's actually implemented in the file, or do you need to read in multiple lines until you get to a collection of characters that have '\n' in them? (ie, if you were to open it with a vi or notepad editor, would the text be seen on the screen or not?)
Feb 20 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.