Click here to Skip to main content
11,577,494 members (45,208 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++
i have a string array which keeps data which read from a file.
it consists 76 lines.

what i want to do is store those in different arrays.
like from 21st line to 31st line in 1 array. and 31st to 41st one array. how can i do it... plz help
Posted 31-Dec-12 19:10pm
Comments
Sergey Alexandrovich Kryukov at 1-Jan-13 1:34am
   
Help with what? You did not explain where did you stuck. What did you try so far?
And what, if you have 77 line, the solution will be different? :-)
—SA
Sith Indunil at 1-Jan-13 1:55am
   
i want to split 77 lines into 7 arrays each containing 10 lines of it. and do it without using vectors

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

The thing is, you have to loop through every key in the string (char* or something..) and search for line-feeds (probably '\n's) and keep counting them. If the line-feed count is a multiple of 10 (or whatever number you want), You put those 10-lines in a new string array.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 DamithSL 180
1 OriginalGriff 115
2 Richard MacCutchan 100
3 Abhinav S 90
4 Peter Leow 80
0 OriginalGriff 820
1 Sergey Alexandrovich Kryukov 681
2 Abhinav S 528
3 F-ES Sitecore 420
4 Suvendu Shekhar Giri 375


Advertise | Privacy | Mobile
Web04 | 2.8.150603.1 | Last Updated 1 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100