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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:19:04+00:00 2026-05-15T08:19:04+00:00

I am trying to set up a list of file names for a parameter

  • 0

I am trying to set up a list of file names for a parameter to SHFileOperation. I want to be able to concatenate a file name onto the char array, but i dont want to get rid of the terminating character. for example, I want this:
C:\…\0E:\…\0F:\…\0\0

when i use strcat(), it overwrites the null, so it looks like
C:\…E:\…F:\…0\

Is there any easy way to do this? or am i going to have to code a new strcat for myself?

  • 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-15T08:19:04+00:00Added an answer on May 15, 2026 at 8:19 am

    The code is pretty straightforward. Use a helper pointer to track where the next string should start. To update the tracker pointer, increment by the length of the string +1:

    const char *data[] = { "a", "b", "c" };
    size_t data_count = sizeof(data) / sizeof(*data);
    size_t d;
    size_t buffer_size;
    char *buffer;
    char *next;
    
    // calculate the size of the buffer 
    for (d = 0; d < data_count; ++d)
        buffer_size += (strlen(data[d] + 1);
    buffer_size += 1;
    
    buffer = malloc(buffer_size);
    
    // Next will track where we write the next string
    next = buffer;
    
    for (d = 0; d < data_count; ++d)
    {
        strcpy(next, data[d]);
    
        // Update next to point to the first character after the terminating NUL
        next += strlen(data[d]) + 1;
    }
    *next = '\0';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to set up a file that list all of the files in
I'm trying to set up an accordian style list of tabs where I can
I am trying to create a list box that displays a set of data
Im trying to set the certificate friendly name during the certificate request/acceptance process. I
I'm trying to use a batch file to list files in a directory such
I'm trying to make an Applescript that takes a list of names and makes
I'm trying to create a batch file which will loop around a list of
I'm trying to keep my HTML very simple. I have a set list which
I am trying to set alternate colors of an entry in a list view.
I'm trying to loop through a list (csv) containing two fields; a name and

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.