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

  • SEARCH
  • Home
  • 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 772871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T18:52:22+00:00 2026-05-14T18:52:22+00:00

I have a direct3d project that uses D3DXCreateTextureFromFile() to load some images. This function

  • 0

I have a direct3d project that uses D3DXCreateTextureFromFile() to load some images. This function takes a LPCWSTR for the path to file. I want to load a series of textures that are numbered consecutively (ie. MyImage0001.jpg, MyImage0002.jpg, etc) But c++’s crazy strings confuse me.

How do i:

for(int i=0; i < 3;i++)
{
//How do I convert i into a string path i can use with D3DXCreateTextureFromFile?
}

Edit:

I should mention I am using Visual Studio 2008’s compiler

  • 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-05-14T18:52:23+00:00Added an answer on May 14, 2026 at 6:52 pm

    One option is std::swprintf:

    wchar_t buffer[256];
    std::swprintf(buffer, sizeof(buffer) / sizeof(*buffer),
                  L"MyImage%04d.jpg", i);
    

    You could also use a std::wstringstream:

    std::wstringstream ws;
    ws << L"MyImage" << std::setw(4) << std::setfill(L'0') << i << L".jpg";
    ws.str().c_str();  // get the underlying text array
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently I have the following code for a project that represents some probability trees
I have a complex project that uses a Ruby::Rake system to generate java (and
I have a project in PHP that uses multiple tabs on a single page,
I have an XML file that encodes a directed acyclic graph (DAG) that represents
I have a WinForms application that uses XNA to animate 3D models in a
I have a computer that won't let me enable direct3d acceleration (i've tried almost
I know that this is quite subjective, but is it something that I have
I have a MVC 2 project runnin in .net 3.5. There are some Webforms
I have a maven pom build file in the root directory of my project.
I have this vector. vector<CXFileEntity>* menu;// CXFileEntity is class When i try load an

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.