Page 1 of 1

RANDOM FileName ?

Posted: Sat Aug 13, 2022 12:24 am
by AUGE_OHR
hi,

i know

Code: Select all

    GetTempFileName( LPCSTR tmpdir, LPCSTR prefix, UINT unique, LPSTR filename )
but it seems not available under harbour :(

did somebody have made a HB_FUNC( GetTempFileName ) and can share it :?:

p.s. need "A" and/or "W" Function

Re: RANDOM FileName ?

Posted: Sat Aug 13, 2022 7:34 am
by edk
Maybe this func will be useful:
hb_vfTempFile(@<cFileName>, [<cDir>], [<cPrefix>], [<cExt>], [<nAttr>]) ➜ pHandle> | NIL
creates a temp file and stores its randomly constructed name into cFileName parameter variable (which must be passed by reference).
Returns a file handler (pointer) on created file or NIL on failure.
NOTE: the temporary file is created always on local system (i.e. without switching to FILE IO redirector), into <cDir> or into user's %TEMP% directory if no <cDir> specified.
It remains opened until it's closed either imperatively (f.e. by using hb_vfClose(<pHandle>)) or by Operating System (upon program termination).

Re: RANDOM FileName ?

Posted: Sat Aug 13, 2022 4:47 pm
by franco
Jimmy, Not sure if this what you are looking for but I create memo files from invoice numbers, and these are shared in a folder on server.
Also in my scheduler I create memo files from with name from time and day of appointment, shared in a folder on server.
If this is what you mean I could give sample.