Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing a filename to the current date\time
Message
 
To
25/02/2004 14:24:25
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00876476
Message ID:
00880820
Views:
16
Hi Mike,

PMFJI...

You should be using "_" + SUBSTR(SYS(2015, 4)) rather than SYS(3) for your file names.

Reason: SYS(3) can generate non-unique names when used in rapid succession on a fast machine, and if you're using CREATE TABLE with these names and not placing an underscore or some other character in front of it, you'll occasionally get a number as the first character, for which VFP generates an error when you try and create the file.

Also, right after you generate the unique name, call the SYS(2000) function with the full path added to the (purportedly unique new) file name. The function returns a string; checking for an empty result string will confirm that the file doesn't exist. This function, unlike FILE(), doesn't search the VFP path.

>How can I be assured that it will be unique? I use the sys(3) function to produce probably hundreds of files, and if one is accidentally overwritten it would be bad. Thanks!
>
>MAC
Evan Pauley, MCP
Positronic Technology Systems LLC
Knoxville, TN

If a vegetarian eats vegetables, what does a humanitarian eat?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform