Juno Posted November 30, 2004 Share Posted November 30, 2004 Hello Has anyone had any experience with the EOLN command? I have a tab delimited text file and EOLN appears to view the tabs as carriage returns. Is there a different delimiter I am supposed to use? Thanks, -juno Quote Link to comment
Guest Posted December 8, 2004 Share Posted December 8, 2004 If you can be sure that each line contains the same number of fields, you can just do: ReadLn(fieldOne, fieldTwo, fieldThree); and all three variables will get assigned in one shot. Note that PASCAL requires that each field be non-nil for this to work. So if the data actually look like this: something-tab-tab-something you'll have problems. One way to solve this problem, if you're writing the file, is simply to make sure that you don't write any non-nil fields (come up with something that to you denotes an empty field, and write that instead of a nil string). In situations where the number of fields can vary, I usually just use StdReadLn, which reads the whole line into one variable. Then I parse the variable, looking for the delimiters myself. It's a pain, but it's reliable. Quote Link to comment
Juno Posted December 8, 2004 Author Share Posted December 8, 2004 Unfortunately, the lines can have a variable number of entries. The StdReadLn is a possible solution but you are right, it is a pain. EOLN seemed like a simple answer but it doesn't work the way I expected it to, unlike EOF. Thanks for the suggestions, -juno Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.