> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XPersistentLocalStorageGetPathSize

> XPersistentLocalStorageGetPathSize

# XPersistentLocalStorageGetPathSize

Retourne la longueur, en caractères, du chemin d'accès au stockage local persistant (PLS).

## Syntaxe

```cpp theme={null}
HRESULT XPersistentLocalStorageGetPathSize(  
         size_t* pathSize  
)  
```

### Paramètres

*pathSize*   \_Out\_\
Type : size\_t\*

La longueur, en caractères, du chemin du PLS.

### Valeur de retour

Type : [HRESULT](https://learn.microsoft.com/openspecs/windows_protocols/ms-erref/0642cb2f-2075-4469-918c-4441e69c548a)

Retourne **S\_OK** en cas de réussite; sinon, retourne un code d'erreur. Pour obtenir la liste des codes d'erreur, consultez [Codes d'erreur](/fr-CA/reference/errorcodes).

## Remarques

<Note>Il n'est pas sécuritaire d'appeler cette fonction sur un thread sensible au temps. Pour plus d'informations, consultez [Threads sensibles au temps](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads).</Note>

La valeur de retour de cette fonction est utilisée pour le paramètre *pathSize* de la fonction [XPersistentLocalStorageGetPath](/fr-CA/reference/system/xpersistentlocalstorage/functions/xpersistentlocalstoragegetpath) afin de retourner le chemin du PLS propre au jeu sur l'appareil. Pour plus d'informations sur le PLS, consultez [Stockage local](/fr-CA/build/console-features/storage/local-storage).

Lorsque vous appelez la fonction **XPersistentLocalStorageGetPath**, allouez pour le paramètre *path* de **XPersistentLocalStorageGetPath** au moins autant de caractères que le nombre indiqué par la valeur retournée dans le paramètre *pathSize* de cette fonction; sinon, une erreur se produira.

L'exemple suivant montre comment utiliser les fonctions **XPersistentLocalStorageGetPathSize** et **XPersistentLocalStorageGetPath** pour obtenir le chemin du PLS de votre jeu.

```cpp theme={null}
// Confirm that all of the features needed to run asynchronous tasks on 
// task queues are available.
LPCSTR Game::CheckPLSPath()
{
    // Confirm the length of the path to the local storage folder.
    LPCSTR returnPath = "";
    size_t pathSize;
    if (SUCCEEDED(XPersistentLocalStorageGetPathSize(&pathSize)))
    {
        char * path = new char[pathSize];
        size_t * pathUsed = new size_t;
        if (path != nullptr)
        {
            // Get the path to the local storage folder.
            if (SUCCEEDED(XPersistentLocalStorageGetPath(pathSize, path, pathUsed))) 
            {
                // Just to be safe, copy the bytes used in the buffer 
                // to a separate string.
                char * actualPath = new char[*pathUsed];
                strncpy(actualPath, path, *pathUsed);
                returnPath = actualPath;
            }
        }
    };

    return returnPath;
}
```

## Configuration requise

**En-tête :** XPersistentLocalStorage.h

**Bibliothèque :** xgameruntime.lib

**Plateformes prises en charge :** Windows, consoles de la famille XBOX One et consoles XBOX Series

## Documentation conceptuelle

* [Stockage local sur la console XBOX](/fr-CA/build/console-features/storage/local-storage)
* [Threads sensibles au temps](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## Voir aussi

[XPersistentLocalStorageGetPath](/fr-CA/reference/system/xpersistentlocalstorage/functions/xpersistentlocalstoragegetpath)\
[XPersistentLocalStorage](/fr-CA/reference/system/xpersistentlocalstorage/xpersistentlocalstorage_members)\
[Comment utiliser le nouveau fichier MicrosoftGame.config](/fr-CA/build/core-features/common/game-config/MicrosoftGameConfig-toc)


## Related topics

- [XPersistentLocalStorageGetPathSize](/ko/reference/system/xpersistentlocalstorage/functions/xpersistentlocalstoragegetpathsize.md)
- [XPersistentLocalStorageGetPath](/reference/system/xpersistentlocalstorage/functions/xpersistentlocalstoragegetpath.md)
- [Local storage](/build/console-features/storage/local-storage.md)
- [XPersistentLocalStorage](/reference/system/xpersistentlocalstorage/xpersistentlocalstorage_members.md)
- [XPersistentLocalStorageGetSpaceInfo](/reference/system/xpersistentlocalstorage/functions/xpersistentlocalstoragegetspaceinfo.md)
