Я создал приложение DirectX12 по умолчанию (вращающийся 3D куб) и в моем void DX::DeviceResources::Present()
я пытаюсь написать BackBuffer в файл:C ofstream ++: Не удается найти файл вывода
// Present the contents of the swap chain to the screen.
void DX::DeviceResources::Present()
{
// The first argument instructs DXGI to block until VSync, putting the application
// to sleep until the next VSync. This ensures we don't waste any cycles rendering
// frames that will never be displayed to the screen.
HRESULT hr = m_swapChain->Present(1, 0);
UINT backBufferIndex = m_swapChain->GetCurrentBackBufferIndex();
ComPtr<ID3D12Resource> spBackBuffer;
m_swapChain->GetBuffer(backBufferIndex, IID_PPV_ARGS(&spBackBuffer));
//before writing the buffer, I want to check that the file is being
//created
ofstream myfile;
myfile.open("WHEREISTHEFILE.txt");
myfile << "Writing this to a file.\n";
myfile.close();
// If the device was removed either by a disconnection or a driver upgrade, we
// must recreate all device resources.
if (hr == DXGI_ERROR_DEVICE_REMOVED || hr == DXGI_ERROR_DEVICE_RESET)
{
m_deviceRemoved = true;
}
else
{
DX::ThrowIfFailed(hr);
MoveToNextFrame();
}
}
Проблема происходит здесь:
ofstream myfile;
myfile.open("WHEREISTHEFILE.txt");
myfile << "Writing this to a file.\n";
myfile.close();
Я просто хочу, чтобы написать файл первым (как было показано, как here), прежде чем пытаться записать содержимое буфера. Теперь по какой-то причине я не могу найти выходной файл ... Я искал всюду, все каталоги в моем проекте и даже в папке Microsoft DirectX SDK.
Исключений нет, и я могу проходить каждую строку во время отладки без ошибок.
Где это может быть?
проверить каталог выполнения, обычно устанавливаемый в опции «start in» –