Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

error in reading line  RSS feed

 
preethi Ayyappan
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to read the textfile which has numbers 1 to 99 and its equivalent voice file (for example 1-N001,2-N002 etc...). I can able to read it. But what i need is for example if i type 1,22,3,45. It should match 1 with the value 1, 22 with the value 22 in the text file in the text file , 3 with the value 3 in text file and 45 with 45 in the text file and it should play 1 lakh, 22 thousand,3 hundred and 45. But instead it is playing 1 lakh, 3 hundred,22 thousand and 45. The file is reading the lines one by one. so before 22 it is reading 3. How can i readaccording to the order typed.



please assist me solve this issue.

Thanks
 
prem pillai
Ranch Hand
Posts: 87
Java Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Load the file in to a map with your index number as the key and voice file name as the value. Then lookup the map using your input value tokens (cvalue , c1 value etc) ....

Just add , the code you have written is too raw and buggy.. check how you can imrpove it.
 
preethi Ayyappan
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. Can you show me a sample please?
 
Clarence Gillespie
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remove lines 19, 27 & 35...Your streaming the dynamic entry you created in the voiceFile variable and then streaming a hard-coded entry following each line in question.

Hope it helps.
 
Campbell Ritchie
Marshal
Posts: 55751
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Clarence Gillespie, welcome to the Ranch
 
preethi Ayyappan
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks prem. I have done as per your advice and now the issue has been solved. I have created an array of voice file name with index and mapped the dynamic value with index and got the voice file name and able to stream properly.

Gillespie, I have to stream both the dynamic file and also the hard coded voice file. both are different files.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!