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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:57:59+00:00 2026-05-15T16:57:59+00:00

In C programming, whenever I try to perform first time cat, I need to

  • 0

In C programming, whenever I try to perform first time cat, I need to

TCHAR file_name[1024];
// Use memset or set the first byte to 0?
file_name[0] = 0;
_tcscat(file_name, TEMP_DIRECTORY_PATH);
_tcscat(file_name, file);

I see most programmers are using memset. But, for me, I just set the first byte to 0, to let _tcscat knows where to start from.

I am not sure whether there is any shortcoming / trap for doing so, instead of using memset?

Thanks.

  • 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-15T16:58:00+00:00Added an answer on May 15, 2026 at 4:58 pm

    You can just set the first char to 0.

    However an even easier way would be to

    TCHAR file_name[1024];
    _tcsncpy(file_name, TEMP_DIRECTORY_PATH, 1024);
    _tcscat(file_name, file);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Programming is (so far) just a hobby for me, so I try to find
Programming has come a long way. I am still relatively young (first Computer: C64),
Greetings, I am currently exploring some extreme programming and try to stick as much
Whenever I have to work with topics like file-handling or socket-programming, I have to
I'm programming a basic game in cocos2d, and whenever I transition into one of
Whenever I'm typing programming keywords in vim they get specific colors. I'd like to
I want to solve geometry problems in online programming contests. But whenever I read
Let me first try to explain what I'm trying to achieve. I'm making a
Which one is best in programming - int or Integer ? Especially whenever both
I'm programming a small widget that needs to be updated whenever the user changes

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.