Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8770025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:28:31+00:00 2026-06-13T17:28:31+00:00

Im having some probolems with C++ .. I’m trying to save a frame with

  • 0

Im having some probolems with C++ .. I’m trying to save a frame with the filename as timestamp but with no success, can anybody help me?

It saves properly if i use:

D3DXSaveTextureToFileW((LPCWSTR)"file.bmp",D3DXIFF_BMP,tex,NULL); or

D3DXSaveTextureToFileW(L"file.bmp", frameName,D3DXIFF_BMP,tex,NULL); 

But if I try some more elaborated filename I get some issues, it compiles but doesn’t save the file …

I’m trying to use someting like

LPCWSTR frameName;
std::string s = std::string("file") + std::string(".bmp");
frameName = (LPCWSTR)s.c_str();
D3DXSaveTextureToFileW((LPCWSTR)frameName,D3DXIFF_BMP,tex,NULL);

Doesn’t save … And If I try something like I want to save the problem continues:

time_t seconds;
seconds = time (NULL);      
time_t rawtime;
time ( &rawtime );

LPCWSTR frameName;
std::string s = std::string("file") + std::string(&rawtime);
frameName = (LPCWSTR)s.c_str();

D3DXSaveTextureToFileW((LPCWSTR)frameName,D3DXIFF_BMP,tex,NULL);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T17:28:32+00:00Added an answer on June 13, 2026 at 5:28 pm

    You cannot cast the result of std::string::c_str() (a const char*) to a LPCWSTR. Use a std::wstringstream to construct the filename:

    #include <sstream>
    ...
    std::wstringstream frameName;
    frameName << L"file" << rawtime << L".bmp";
    D3DXSaveTextureToFileW(frameName.str().c_str(),D3DXIFF_BMP,tex,NULL);
    

    If you want to store the result of frameName.str() use a std::wstring.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having some problems trying to figure out how to generate a Google Map
I'm having some problems while using PDO. It all seems correct but I am
I'm having some problems with the jQuery UI slider widget. I can get the
Having some problems with customizing the UINavigationController. The size change is working, but the
I'm having some problems with data binding in XAML and WPF. Specifically, I'm trying
Having some problems with syntax here. Trying to get like counts on any page
im having some problems trying to read a SQlite data base from flash using
I'm having some problems importing custom options with the magmi datapump api. I can
I'm having some problems unregistering a BroadcastReceiver . I'm first registering it but then
I am having some problems with my php code: All information returns but I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.