Variable tmp

Résolu
aurelbobol6 Messages postés 36 Date d'inscription jeudi 29 mars 2007 Statut Membre Dernière intervention 4 février 2009 - 9 déc. 2008 à 15:32
aurelbobol6 Messages postés 36 Date d'inscription jeudi 29 mars 2007 Statut Membre Dernière intervention 4 février 2009 - 9 déc. 2008 à 15:49
Bonjour,

je nécessite une nouvelle fois votre aide . Comment récupère-t-on la variable "tmp" sous c++. Je sais que sous java, on fait:
String tmpDir = System.getProperty("java.io.tmpdir");

Mais la je suis un peu perdu...

Merci d'avance pour votre aide

Aurel

2 réponses

aurelbobol6 Messages postés 36 Date d'inscription jeudi 29 mars 2007 Statut Membre Dernière intervention 4 février 2009
9 déc. 2008 à 15:49
oui c'est mon répertoire temporaire.
Oui merci c'est avec: GetTempPath, en voici un exemple que j'ai trouvé

#include <windows.h>
#include <stdio.h>
#define BUFSIZE 4096

int main(int argc, char* argv[])
{
    DWORD dwRetVal;
    DWORD dwBufSize=BUFSIZE;    // length of the buffer
    char lpPathBuffer[BUFSIZE]; // buffer for path

    // Get the temp path.
    dwRetVal = GetTempPath(dwBufSize, lpPathBuffer);

    if (dwRetVal > dwBufSize)
    {
        printf ("GetTempPath failed with error %d.\n",
                GetLastError());
        return (2);
    }
    printf("GetTempPath returned: %s", lpPathBuffer);
    while(true)
    {}
    return (0);
}
3
fregolo52 Messages postés 1114 Date d'inscription mercredi 15 juin 2011 Statut Membre Dernière intervention 6 mai 2021 4
9 déc. 2008 à 15:47
Je connais pas java, mais c'est quoi ta variable tmp ? Le répertoire temporaire de l'OS ?
Si tu es sous windows c'est : GetTempPath
0
Rejoignez-nous