<div dir="ltr">Hola User,<div class="gmail_extra"><br></div><div class="gmail_extra">El error está en que conviertes un tipo de 'ULONGLONG', que el API de MS-Windows define para representar un tipo entero sin signo de 64 bits, a un 'int' que seguramente representa un entero (con signo) de 32 bits. Esto significa que perderás bits de información obteniendo un resultado bastante diferente al esperado.</div><div class="gmail_extra"><br></div><div class="gmail_extra">C++ ofrece el tipo de dato 'unsigned long long int', por lo que no deberías tener problemas con 'ULONGLONG'. Simplemente, usa el valor guardado directamente en 'cout <<'; por ejemplo,</div><div class="gmail_extra"><br></div><div class="gmail_extra">cout << "Free drive space: " << freeBytesToCaller.QuadPart << "Bytes" << endl;<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">También ten presente que 'freeBytesToCaller' contendrá la cantidad de bytes disponible para el usuario en la sesión de MS-Windows que ejecuta este programa. Esto implica que puede haber cuotas para limitar la cantidad adjudicada de espacio disponible a tal usuario y por tanto no reflejará necesariamente la cantidad "real" disponible de bytes en el volumen o disco.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Espero haber aclarado la duda.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Steven</div><div class="gmail_extra"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 2, 2015 at 11:39 AM, User <span dir="ltr"><<a href="mailto:usuarioanonimomysql@gmail.com" target="_blank">usuarioanonimomysql@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><pre style="margin-top:0px;margin-bottom:0px">Hola,</pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px">Estoy tratando de obtener el espacio libre de una unidad de disco. Ejecuto lo siguiente:</pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px">    LPCWSTR drive=L"C:\\";

    ULARGE_INTEGER freeBytesToCaller;
    freeBytesToCaller.QuadPart = 0L;

    if( !GetDiskFreeSpaceEx( drive, &freeBytesToCaller, NULL, NULL ) )
    {
    cout << "ERROR: Call to GetDiskFreeSpaceEx() failed." << endl;
    }

    int freeSpace_gb = freeBytesToCaller.QuadPart;
    cout << "Free drive space: " << freeSpace_gb << "Bytes" << endl;<br></pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px">Pero <span style="font-family:arial,sans-serif">freeSpace_gb </span><span style="font-family:arial,sans-serif">me da un valor de 1634967552 cuando solo tengo 9 GB libres.</span></pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px">¿Qué problema hay?</pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px">Gracias.</pre></div>
</blockquote></div><br></div></div>