Jump to content
  • Advertisement
Sign in to follow this  

problem with LPD3DXBUFFER (writing to file)

This topic is 5112 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Sorry for stupid question. I have: LPD3DXBUFFER lpError; D3DXCreateEffectFromFile( C_View::p_D3DDevice, fileName, &g_lpEffect, &lpError ); How can I save content lpError to file (in VC++)?

Share this post

Link to post
Share on other sites
(1) Allocate a character buffer
(2) Copy the error buffer into the character buffer
(3) Output to file

// This is our error buffer

// Attempt to create the effect
if( FAILED( D3DXCreateEffectFromFile( d3dDevice, "effect.fx", NULL, NULL, 0, NULL, &effect, &buffer ) ) )
// Error(s) have occured.
// Allocate a character buffer the size of the ID3DXBuffer
char* data = new char[buffer->GetBufferSize()];

// Copy the buffer data over
memcpy( data, buffer->GetBufferPointer(), buffer->GetBufferSize() );

// Open a file and output the error string(s)
FILE* file = fopen( "errors.txt", "w" );
fprintf( file, "%s", data );
fclose( file );

// Release allocated objects
delete[] data;

return E_FAIL;

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!