Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Help datafile
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
KONjbnj




PostPosted: Wed Jun 08, 2005 8:31 am   Post subject: Help datafile

hey..i was wondering how would u be able to make a loop so that it only reads parts of a datafile i tried exit when when it gets to a certain part but it doesnt work..i need the loop to stop at a certain point.

thanks

[code]
loop

exit when eof (datafile)
get : datafile, food, price, combo, save
put food : 20, price : 10, combo : 10, save : 10
exit when food ="hamburger"
delay (100)


end loop
[/code]
Sponsor
Sponsor
Sponsor
sponsor
jamonathin




PostPosted: Wed Jun 08, 2005 11:40 am   Post subject: (No subject)

Yes it is possible, you just have your coding wrong.

Take a look at these two programs. 'data' is just the text, and 'data get' gets the data.

Remove the comment to stop at hamburger.



data get.t
 Description:
Program

Download
 Filename:  data get.t
 Filesize:  671 Bytes
 Downloaded:  130 Time(s)


data.t
 Description:
data

Download
 Filename:  data.t
 Filesize:  37 Bytes
 Downloaded:  134 Time(s)

Cervantes




PostPosted: Wed Jun 08, 2005 5:50 pm   Post subject: (No subject)

jamonathin wrote:
Yes it is possible, you just have your coding wrong.

En contrare, I think he's got his text file wrong. Assuming the textfile is set up in the correct format (food, price, combo, save), his code should work.
KONjbnj, would you please post the data file you were using?
Delos




PostPosted: Wed Jun 08, 2005 6:48 pm   Post subject: (No subject)

Cervantes->Delos.babel fish wrote:

"Au contraire"
KONjbnj




PostPosted: Thu Jun 09, 2005 8:01 am   Post subject: (No subject)

`here is datafile


menu.txt
 Description:

Download
 Filename:  menu.txt
 Filesize:  69 Bytes
 Downloaded:  92 Time(s)


menu.txt
 Description:

Download
 Filename:  menu.txt
 Filesize:  69 Bytes
 Downloaded:  118 Time(s)

KONjbnj




PostPosted: Thu Jun 09, 2005 8:27 am   Post subject: (No subject)

yay, I got it to work! thanks guys

though i dont think i did it how you guys did it.
jamonathin




PostPosted: Thu Jun 09, 2005 8:50 am   Post subject: (No subject)

Cervantes wrote:
I think he's got his text file wrong.


Yeah, you have to have the same casings KonJubIXoRz
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 7 Posts ]
Jump to:   


Style:  
Search: