#include <stdio.h>
#include <Windows.h>
int main()
{
TCHAR buff[1024];
GetLogicalDriveStrings(1024, buff);
int i;
for(i = 0; buff[i] != 0; i += 4)
printf("%S", buff+i);
}
When I try to compile it with MSVC, I get the following errors:
Commenting out GetLogicalDriveStrings(1024, buff); causes the code to compile just fine
Older version of C require local variables to be declared at the beginning of a block, before things like function calls. Move the
int i;to the top of the function to be with the declaration ofbuff.C++ did away with this requirement, as did C99.