Mike Lewis
Programmer
Well, it's been quiet here in the forum this week. I hope this lack of activity isn't causing your brains to go to sleep. Just in case it is, here is a little question to give you something to think about over the weekend.
You have a table open in the current work area. The record pointer can be pointing at any record (including EOF). There might or might not be an index order set. There might or might not be a filter in force. DELETED might be ON or OFF.
Your job is to write some code that will move the record pointer to the physical top of the file. By "physical top of the file", I mean the first physical record, not necessarily the first record in index order. This applies even if the record is marked for deletion, and if it is not included in any current filter.
You may assume that the table is not empty.
Apart from the change in the record pointer, the code should leave the environment exactly as it finds it (so if you change any setting, you must change it back again afterwards).
Easy enough, no? Kudos will go to the person who solves the problem in the least amount of code, that is, the fewest number of lines and the shortest lines.
(If you are one of the first to post a solution, consider using the [ignore][/ignore] tags to temporarily hide your answer so that others can have a shot.)
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
Visual FoxPro articles, tips and downloads
You have a table open in the current work area. The record pointer can be pointing at any record (including EOF). There might or might not be an index order set. There might or might not be a filter in force. DELETED might be ON or OFF.
Your job is to write some code that will move the record pointer to the physical top of the file. By "physical top of the file", I mean the first physical record, not necessarily the first record in index order. This applies even if the record is marked for deletion, and if it is not included in any current filter.
You may assume that the table is not empty.
Apart from the change in the record pointer, the code should leave the environment exactly as it finds it (so if you change any setting, you must change it back again afterwards).
Easy enough, no? Kudos will go to the person who solves the problem in the least amount of code, that is, the fewest number of lines and the shortest lines.
(If you are one of the first to post a solution, consider using the [ignore][/ignore] tags to temporarily hide your answer so that others can have a shot.)
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
Visual FoxPro articles, tips and downloads