Greg: "win_dir()" problems... 12/32/2003 :-)
- Posted by Al Getz <Xaxo at aol.com> Dec 16, 2005
- 535 views
Hello there, Greg, since you wrote this i guess you want to know the following information... First problem is that the 'day' is always one more than the actual day, so the file date 12/31/2003 gets returned as 12/32/2003. The simple fix was to rem out the part where 'day' is incremented... day=something+1 (or something like that) is changed to day=something. Second problem is that normally the user will want the same time shown in the Windows Explorer...namely, the "Local Time", and not the "UTC". The simple fix was to convert the utc time to local time using the api "FileTimeToLocalFileTime" call... Instead of calling void=FileTimeToSystemFileTime(pft,pst) first call void=FileTimeToLocalFileTime(pft,pft2) and after that call void=FileTimeToSystemFileTime(pft2,pst) The returned values then match up with Windows Explorer, and are the correct time values for the particular users computer according to how he has his local time set. After making the above two changes the program works really well and im able to use this already in a program in which i was calling system(dir...>filename) and then reading the filename file to get the dir info with paths longer than 100 characters. I still use Eu's "dir()" function for shorter ones, but there are quite a few long ones too so if the path is longer i simply switch now to using your dir function instead. Oh yeah, one little thing is that if the path is a directory and it does not contain a trailing "\\" slash, win_dir() returns only one record or something, so it's not exactly the same as what Eu's dir command returns. Adding the slash at the end gets the whole dir though. This isnt too much of a problem, but you cant simply replace d=dir() with d=win_dir() in your program and expect it to work exactly the same because it wont. Perhaps you can find a way to fix this also, which would be nice :) In the mean time, im using it with the above changes and using a trailing slash char and it's working the same as when i was reading the file written first with system dir so im happy with it. Now i can eliminate the system call as well as the file read which will speed things up a little. It's a cleaner program now too in that it doesnt have to write a temporary file anywhere. Take care, Al And, good luck with your Euphoria programming! My bumper sticker: "I brake for LED's"