• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Reading strings from a line problem _ any help!!

 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

My test main class allows user input to create one integer, which I've converted to a string, plus four strings representing details to be written to a file. When these details are written to the file they initially read correctly, eg:


111,hello one,hello two,hello three,hello four



The problem occurs when I try to write a second set if user entry values to this file. It is expecting four strings as words, and therefore reads and writes the above line as follows,


111,,hello,one,hello,two,hello,three,hello



I have absolutely no idea why this is happening and would really appreciate some help or advice with this problem.

The current code for my test main class is as follows,


Any help or advice really appreciated at this stage!!
 
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is rather difficult to give a good reply, because your code is based on the classes like TitleList, SimpleReader and SimpleWriter, which are not part of standard Java.

Guessing at what SimpleReader and SimpleWriter are trying to do, I cannot see anything immediately wrong with your code. However, something must be wrong if you are seeing wrong behaviour, so we would need to see exactly what these other classes do. That might be too much code to post, though.
 
celine scarlett
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Thanks for the reply. SimpleReader and Writer allow basic reading in and out of files etc. My current code for the TitleList class is as follows,



The above class also uses the basic Title class which is as follows,


Can anybody see why this problem is occurring?

Any help gratefully appreciated!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic