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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:34:45+00:00 2026-05-16T17:34:45+00:00

I have this code. I would like to put argv[1] as prefix to fileName.

  • 0

I have this code. I would like to put argv[1] as prefix to fileName. How do I do that?

int _tmain(int argc, char** argv)
{
...
    _stprintf(fileName, _T("%04d-%02d-%02d-%02d-%02d-%02d-%03d.jpeg"), lt.wYear, lt.wMonth, lt.wDay, lt.wHour, lt.wMinute, lt.wSecond, lt.wMilliseconds);
  • 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-16T17:34:45+00:00Added an answer on May 16, 2026 at 5:34 pm
    _stprintf(fileName, _T("%s-%04d-%02d-%02d-%02d-%02d-%02d-%03d.jpeg"), argv[1], lt.wYear, lt.wMonth, lt.wDay, lt.wHour, lt.wMinute, lt.wSecond, lt.wMilliseconds);
    

    That will do what you want, but since you’re using C++ you would be best to use a stringstream instead.

    #include <stringstream>
    
    int main(int argc, char** argv)
    {
        std::stringstream ss;
        ss << argv[1] << "-" << lt.wYear << "-" << lt.wMonth << "-" << lt.wDay << "-" << lt.wHour << "-" << lt.wMinute << "-" << lt.wSecond << "-" << lt.wMilliseconds << ".jpeg";
    }
    

    You can then access the string with ss.str(). You can also use the same stream format modifiers you would use with any output stream.

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

Sidebar

Related Questions

I would like to make sure that when user log in it will stay
Right now, I have a layout that looks like one of the two images
I am using Ruby on Rails 3 and I would like to use jQuery
So basically, I have this content provider which I use to store and retrieve
I am writing a python program to process .hdf files, I would like to
I have one main interface and an abstract class implementing all derivable methods (that
I am currently trying to put a RewriteRule into my .htaccess file for my
I'm researching using Mercurial for our companies source control system. One immediate requirement that
I know a little bit of comprehensions in Python, but they seem very hard
Short question : I know how to draw text on a wx.Bitmap, but how

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.