Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Writing arrays

 
Antonio Costa
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

as I couldn't figure out where to put this question feel free to remove it from this forum and put it where it has to stay.

I'm trying to split a large file into several little "chunks" of the same size (counting the number of lines within the file).

Say: if the large file has 5000 lines beginning with "$$ALLBLA" and I will split it in parts of 100 lines, I expect that in each of the 50 chunk there will be 100 lines starting with "$$ALLBLA".

This is the code:

I don't get what I want, so what am I doing wrong?
I suppose the error lies anywhere round line 34 - but I can't see it...

Thanks for all hints.
Antonio
 
Rob Spoor
Sheriff
Pie
Posts: 20751
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to I/O.
 
Antonio Costa
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi again,

I now fixed more or less the problem replacing this piece of code

by this one

I now get the right number of files.
Replacing this piece of code

with this one

I get the desired number of lines in each file.
BUT
after dividing the number of lines evenly on the generated number of files, the last lines in the last file is filled with
"null" statements. Has anybody an idea why?

Thanks
Antonio

----------------------------------------------------------------------------------------------------------------------------------------
Hi,

as I couldn't figure out where to put this question feel free to remove it from this forum and put it where it has to stay.

I'm trying to split a large file into several little "chunks" of the same size (counting the number of lines within the file).

Say: if the large file has 5000 lines beginning with "$$ALLBLA" and I will split it in parts of 100 lines, I expect that in each of the 50 chunk there will be 100 lines starting with "$$ALLBLA".

This is the code:

I don't get what I want, so what am I doing wrong?
I suppose the error lies anywhere round line 34 - but I can't see it...

Thanks for all hints.
Antonio
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic