Hollosi Information eXchange /HIX/
HIX CODER 23
Copyright (C) HIX
1998-02-14
Új cikk beküldése (a cikk tartalma az író felelőssége)
Megrendelés Lemondás
1 Re: Windows temp directory es directory crealas (#22) (mind)  131 sor     (cikkei)

+ - Re: Windows temp directory es directory crealas (#22) (mind) VÁLASZ  Feladó: (cikkei)

Felado: 
> Hogy lehet VC++ 5.0-ban lekerdezni a win temp direktory-jat?
> Nem talaltam ra fv. hivast, pedig szerintem csak kellene, hogy
> legyen.

Szervusz Pisti!

Ugylatszik, neked nincsenek meg a CD-n levo hypertext help-ek, mivel
azokban pillanatok alatt meg lehet talalni a megoldast: :-) 

===
The GetTempPath function retrieves the path of the directory designated
for temporary files. This function supersedes the GetTempDrive function. 

DWORD GetTempPath(
    DWORD nBufferLength, // size, in characters, of the buffer 
    LPTSTR lpBuffer // address of buffer for temp. path 
   ); 

Parameters:
nBufferLength Specifies the size, in characters, of the string buffer
identified by lpBuffer. 
lpBuffer Points to a string buffer that receives the
null-terminated string specifying the temporary file
path. 

Return Values:
If the function succeeds, the return value is the length, in characters,
of the string copied to lpBuffer, not including the terminating null
character. If the return value is greater than nBufferLength, the return
value is the size of the buffer required to hold the path.
If the function fails, the return value is zero. To get extended error
information, call GetLastError. 

Remarks:
The GetTempPath function gets the temporary file path as follows:
1. The path specified by the TMP environment variable. 
2. The path specified by the TEMP environment variable, if
TMP is not defined. 
3. The current directory, if both TMP and TEMP are not
defined.
===
Raadas:
===
The GetTempFileName function creates a name for a temporary file. The
filename is the concatenation of specified path and prefix strings, a
hexadecimal string formed from a specified integer, and the .TMP
extension.
The specified integer can be nonzero, in which case, the function
creates the filename but does not create the file. If you specify zero
for the integer, the function creates a unique filename and creates the
file in the specified directory.

UINT GetTempFileName(
    LPCTSTR lpPathName, // address of directory name for
// temporary file 
    LPCTSTR lpPrefixString, // address of filename prefix
    UINT uUnique, // number used to create temporary
// filename 
    LPTSTR lpTempFileName // address of buffer that receives the
// new filename 
   ); 

Parameters:
lpPathName Points to a null-terminated string that specifies the
directory path for the filename. This string must
consist of characters in the ANSI character set.
Applications typically specify a period (.) or the
result of the GetTempPath function for this parameter.
If this parameter is NULL, the function fails.

lpPrefixString Points to a null-terminated prefix string. The function
uses the first three characters of this string as the
prefix of the filename. This string must consist of
characters in the ANSI character set.

uUnique Specifies an unsigned integer that the function converts
to a hexadecimal string for use in creating the
temporary filename. 
If uUnique is nonzero, the function appends the
hexadecimal string to lpPrefixString to form the
temporary filename. In this case, the function does not
create the specified file, and does not test whether the
filename is unique.
If uUnique is zero, the function uses a hexadecimal
string derived from the current system time. In this
case, the function uses different values until it finds
a unique filename, and then it creates the file in the
lpPathName directory.

lpTempFileName Points to the buffer that receives the temporary
filename. This null-terminated string consists of
characters in the ANSI character set. This buffer should
be at least the length, in bytes, specified by MAX_PATH
to accommodate the path. 

Return Values:
If the function succeeds, the return value specifies the unique numeric
value used in the temporary filename. If the uUnique parameter is
nonzero, the return value specifies that same number.

If the function fails, the return value is zero. To get extended error
information, call GetLastError. 

Remarks:
The GetTempFileName function creates a temporary filename of the
following form:     path\preuuuu.TMP

The following table describes the filename syntax: 
Component Meaning
path Path specified by the lpPathName parameter
pre First three letters of the lpPrefixString string
uuuu Hexadecimal value of uUnique

When Windows shuts down, temporary files whose names have been created
by this function are not automatically deleted. 
To avoid problems resulting from converting an ANSI character set string
to a Windows string, an application should call the CreateFile function
to create a temporary file. 
If the uUnique parameter is zero, GetTempFileName attempts to form a
unique number based on the current system time. If a file with the
resulting filename exists, the number is increased by one and the test
for existence is repeated. Testing continues until a unique filename is
found. GetTempFileName then creates a file by that name and closes it.
When uUnique is nonzero, no attempt is made to create and open the file. 
==

Elnezest a hosszu idezetekert.

-- 
Tibor  >> PGP-key & home:  http://members.tripod.com/~MTBF <<

AGYKONTROLL ALLAT AUTO AZSIA BUDAPEST CODER DOSZ FELVIDEK FILM FILOZOFIA FORUM GURU HANG HIPHOP HIRDETES HIRMONDO HIXDVD HUDOM HUNGARY JATEK KEP KONYHA KONYV KORNYESZ KUKKER KULTURA LINUX MAGELLAN MAHAL MOBIL MOKA MOZAIK NARANCS NARANCS1 NY NYELV OTTHON OTTHONKA PARA RANDI REJTVENY SCM SPORT SZABAD SZALON TANC TIPP TUDOMANY UK UTAZAS UTLEVEL VITA WEBMESTER WINDOWS