Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

breaking up a file that has a delimiter

 
roy williams
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a file that has three messages in it. the messages are separated by *** I would like to go into the file and read the bytes and when it gets to a *** stop and write that message to a different file then go until the next *** and write that to file and so on..
can anyone help explain what I should use? a snippet etc?
thanks a million!
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
roy williams
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks alot.
Are you saying read the entire file and turn it into a string then use this tokeniizer??
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yup. It's not the only way to do this, but it's probably the easiest (unless the file is really long and memory usage is a problem).
 
roy williams
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I will give it a try. Thank you very much for your replies.
have a great day!
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Roy
if u want to use little complex thing then u can try StreamTokenizer as well...
regards
maulin
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic