Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Wouter Benoit
Starting Member
23 Posts |
Posted - 2008-05-21 : 12:57:29
|
Hello,I'm creating a sort of game where you have to guess a word from a file.In the file are several words and hints and I use the function Random() to generate a random number.I try to read the line from the file that is equal to that generated number.So when the system generates 15 I want to read the 15th line from the file.But I can't seem to find a way to do so.With te readLine() function I can only read the first line of the file, and with the readToEnd() function I read the whole file, which is not necessary.Can someone please explain to me how I can just read the line that I want.Thanks in advanceWouter |
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2008-05-23 : 01:06:55
|
each time you call ReadLine(), it reads the next line. so to read the 15th line you could just call ReadLine() 15 times and keep the result of the 15th call. elsasoft.org |
|
|
Wouter Benoit
Starting Member
23 Posts |
Posted - 2008-05-23 : 09:09:28
|
Thanks |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-05-23 : 09:51:59
|
Or, read the entire file to a string in memory, split the string for vbCrLf and pick the 15th element in the array. E 12°55'05.25"N 56°04'39.16" |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
|
|
|
|