RANDOM FileName ?

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
AUGE_OHR
Posts: 2117
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

RANDOM FileName ?

Post 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
have fun
Jimmy
edk
Posts: 999
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: RANDOM FileName ?

Post 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).
franco
Posts: 921
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: RANDOM FileName ?

Post 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.
All The Best,
Franco
Canada
Post Reply