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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:11:21+00:00 2026-05-18T08:11:21+00:00

I am to the point I am confusing myself but here is what I

  • 0

I am to the point I am confusing myself but here is what I have. I have only recently started to familiarize myself with pointers more to a point I feel more comfortable using them, but I am getting an error about the buffer in strcpy_s() being too small.

Please no comments about me using char arrays instead of std::string, its for the HL2SDK which centers around char arrays (no idea why) so I just stick to the pattern.

void func_a()
{
    char *szUserID = new char[64];
    char *szInviterID = new char[64];
    char *szGroupID = new char[64];
    sprintf(szUserID, "%I64d", GetCommunityID(szUserSteamID));
    sprintf(szInviterID, "%I64d", GetCommunityID(g_CvarSteamID.GetString()));
    GetGroupCommunityID(1254745, &szGroupID); // Group Steam Community ID
}

void GetGroupCommunityID(int groupID, char **communityID)
{
    int staticID = 1035827914;
    int newGroupID = 29521408 + groupID;

    char *buffer = new char[64];
    snprintf(buffer, sizeof(buffer), "%d%d", staticID, newGroupID);
    strcpy_s(*communityID, sizeof(*communityID), buffer);

    delete buffer;
}
  • 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-18T08:11:22+00:00Added an answer on May 18, 2026 at 8:11 am

    The problem is you are using sizeof which is a compile time construct to determine the runtime length of *communityID. This will essentially resolve down to sizeof(char*). What you want though is the number of bytes / chars available in *communityID. This information needs to be passed along with the value

    GetGroupCommunityID(1254745, &szGroupID, sizeof(szGroupID));
    
    void GetGroupCommunityID(int groupId, char** communityID, size_t length) {
      ...
      strcpy_s(*communityID, length, buffer);
    } 
    

    Also in this example a double pointer is unnecessary because you’re not changing the pointer, just it’s contents. A single pointer will do just fine for that

    GetGroupCommunityID(1254745, szGroupID, sizeof(szGroupID));
    
    void GetGroupCommunityID(int groupId, char* communityID, size_t length) {
      ...
      strcpy_s(communityID, length, buffer);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Perhaps a confusing title but let me explain the issue through steps: I have
I am using C Style strings for a project, and I am confusing myself
I seem to be confusing myself the more I dig around the internet for
Kindly point out if i have missed something? I have a project with type
Up to this point, I have used the following code to restrict the application
What's the point or advantages of joining tables using hibernate, such as: @OneToMany @ManyToOne
I have a confusing problem in my code, in which one object gets initialized
Ok this might get confusing cos I have not totally worked out how to
I think I finally get the point of constraints, but still a bit confused.
I have Vector class, representing a 3D point, written as follows in Vector.h :

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.