i'm trying to save multiple .bmp files with the D3DXSaveSurfaceToFile method but unable to solve it, i've tried making random strings/wstrings & convert them to LPCWSTR/LPCSTR, using D3DXSaveSurfaceToFileW / D3DXSaveSurfaceToFileA, but all i get is gibberish.
Any ideas of how to do it? (My project is in C++, Visual Studio, DirectX June 2010)
My solution, if anyone wants it (used char instead):
static int fileIndex = 0;
char fileName[20] = "capture";
sprintf_s(fileName, sizeof(fileName), "%s%d.jpg", fileName, fileIndex);
//sprintf(fileName, "%s%d.jpg", fileName, fileIndex);
size_t size = strlen(fileName) + 1;
wchar_t* wFileName = new wchar_t[size];
size_t outSize;
mbstowcs_s(&outSize, wFileName, size, fileName, size - 1);
//mbstowcs( wFileName, fileName, size - 1);
LPWSTR ptr = wFileName;
D3DXSaveSurfaceToFile(ptr, D3DXIFF_JPG, p, nullptr, nullptr);
fileIndex++;