![]() |
||
| Home | SwiftForth Archive | SwiftX Archive | |

Roger,
I needed something that would create a directory each day and periodically
store chromatogram log files there.
Directories defined yymmdd and files were hhmmss.crm
Here is what I came up with... The ususal warnings apply. I have a problem
with it because if I change directories for some other file operation within
my program, ?TodayDirectory will happily create a directory in the new
path. That issue not solved yet.
Virgil
---
CREATE nameholder 256 ALLOT nameholder 256 ERASE
: BuildFN ( --a )
(@date) 2000 - 10000 * swap 100 * + + 0
<# # # # # # # #> NameHolder Zplace
S" \" NameHolder Zappend
(@time) 10000 * swap 100 * + + 0
<# # # # # # # #> NameHolder Zappend
S" .CRM" NameHolder Zappend
NameHolder ;
: $>Z ( caddr n buf -- buf )
2DUP 2>R SWAP MOVE 2R> TUCK + 0 SWAP C! ;
: ?TodayDirectory ( -- f) \ true if same
BuildFN ZCount -NAME
PAD 256 OVER GetCurrentDirectory -PATH
COMPARE 0= ;
: INVALID-FILE-OP ( addr -- ) hmenuMAIN SWAP Z" File Operation" MB_OK
MessageBox IDRETRY <> ;
: AutoFileSave ( -- )
?TodayDirectory NOT
IF BuildFN ZCount -NAME PAD $>Z SetCurrentDirectory 0=
IF PAD 0 CreateDirectory 0=
IF Z" Can't Create Directory" INVALID-FILE-OP EXIT THEN
PAD SetCurrentDirectory 0=
IF Z" Invalid Directory" INVALID-FILE-OP EXIT THEN
THEN
THEN
NameHolder ZCOUNT -PATH W/O CREATE-FILE
IF Z" Can't Create File" INVALID-FILE-OP EXIT THEN
DUP >R ['] SEND-CHROMO CATCH IF DROP THEN
R> CLOSE-FILE DROP ;
---
----- Original Message -----
From: "Roger Dube" <rdube_at_entropylock.com>
To: <sftalk_at_forth.com>
Sent: Friday, October 03, 2003 6:46 AM
Subject: [sftalk] creating folders
> I need a suggestion:
> I can create, rename and delete files with no problem, but I can't find a
way to create a folder... in fact, the same functions for a folder would be
nice... can someone suggest where I might look to be able to create such
words?
>
> Thanks.
>
> - Roger
> ----------------------------------------------------------------------
> Dr. Roger Dube
>
> RogerDube_at_datHQ.com
> President/CEO
> Digital Authentication Technologies, Inc.
> http://www.datHQ.com/
> TEL +1.561.392.7404
> FAX +1.561.892.2474
>
> PO Box 811564
> Boca Raton, FL 33481-1564
>
----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe" to sftalk-request_at_forth.com
For list command help, send subject "help" to sftalk-request_at_forth.com
Message archives are located at http://www.forth.com/archive/sftalk
----------------------------------------------------------------------
This list is a forum for SwiftForth users. For product support and bug
reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Fri Oct 03 2003 - 16:27:40 PDT
This archive was generated by hypermail 2.2.0 : Wed Jan 07 2009 - 03:04:10 PST