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 8077049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:23:41+00:00 2026-06-05T15:23:41+00:00

First off, the function in question. bool Animation::loadFrames() { sf::Texture frame[frameCount]; std::string pathToFrame; for(int

  • 0

First off, the function in question.

bool Animation::loadFrames()
{
        sf::Texture frame[frameCount];
        std::string pathToFrame;
        for(int i = 1; i < frameCount; i++)
        {
            pathToFrame = pathToAnimation + i + ".jpg";
            if(!frame[i].loadFromFile(pathToFrame)) return false;
        }
        return true;
}

The line that’s giving me trouble is

pathToFrame = pathToAnimation + i + ".jpg";

pathToAnimation is another std::string, frameCount is an int. I want to somehow make one string that looks like: “./Assets/Sprites/Player/Stand/1.jpg”

I know why my code doesn’t work, I just don’t know what the correct code would be.

  • 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-05T15:23:42+00:00Added an answer on June 5, 2026 at 3:23 pm

    In addition to Joachim’s answer, you may also use C++11’s new to_string functions to convert an int into a std::string

    pathToFrame = pathToAnimation + std::to_string(i) + ".jpg";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First off, I want to thank you for looking into my question as I
First of all I apologize in advance for this question, a bit off the
First off, this question is not what does the constructor property do? - There's
First off, fairly new to JS but getting better :-) This question is similar
Ok, first off, I applogize if this question has been asked before, I've spent
First off, sorry for the cryptic question. My team is currently using Selenium 2.0rc3
First off, let me preface this question by saying that my professor is firmly
First off, I apologize if I'm not using the right terms in my question
First off, thanks for reading my question! Secondly, I am looking at developing the
First off I apologize... I have posted this question before, but I did a

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.