CHeighlund
Programmer
I'm working with a program that's supposed to read a flat file in, then parse it for output purposes. I know how you read a file in normally, like this:
The problem here is that I'm not sure I can count on the name of the file I'm reading in being static; if I understand correctly, it's being created by another program that I don't have access to, and the filenames are identified in part by the file's date of creation. (Ex: FOO_102907.txt, BAR_020205.txt, etc.) Is there some way to use a wildcard character in an AssignFile command's second parameter so I can catch anything with the appropriate extension? The extension is an in-house four character combination I can't recall having seen anywhere else before, so I'd assume it's unique enough. And I can guarantee that there will only be one file with the appropriate extension in the target directory I'm trying to read from, I simply can't guarantee the exact name of the file. The problem is, when I've tried using the '*' wildcard, my program throws errors. Is there some other way to pick up a file with a non-static name, or do I need to try and gain access to the original program that creates the file for me in the first place?
Code:
AssignFile(InFile, '[Path]\[to]\[Filename].[ext]');
Reset(InFile);
The problem here is that I'm not sure I can count on the name of the file I'm reading in being static; if I understand correctly, it's being created by another program that I don't have access to, and the filenames are identified in part by the file's date of creation. (Ex: FOO_102907.txt, BAR_020205.txt, etc.) Is there some way to use a wildcard character in an AssignFile command's second parameter so I can catch anything with the appropriate extension? The extension is an in-house four character combination I can't recall having seen anywhere else before, so I'd assume it's unique enough. And I can guarantee that there will only be one file with the appropriate extension in the target directory I'm trying to read from, I simply can't guarantee the exact name of the file. The problem is, when I've tried using the '*' wildcard, my program throws errors. Is there some other way to pick up a file with a non-static name, or do I need to try and gain access to the original program that creates the file for me in the first place?