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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:33:03+00:00 2026-05-24T11:33:03+00:00

In the strtok it doesnt even give me and error it just crashes, below

  • 0

In the strtok it doesnt even give me and error it just crashes, below the g->db_cmd is a char*, can anyone help me out with this issue thank you for the help in advance.

short processCMD(i_gsd_ptr g, i_exit_cb_ptr i_exit_cb, char* i_cmd )
{

  /*-------------------LOCAL VARIABLES-----------------*/
  struct local_stack_def
  {
   char delims[3];
   int x;
   short cmd_match, error,len_eulm,range_eulm, imp_eulm, sub_cmd_match;
   short* cmd_len;
   short* db_len;
   char val_cmd[10];
   _cc_status cc;
   char DataEntry[400];
   char msg_eulm[400];
   char* cmd;
   char* db_cmd;
   char space_const[2]; 
   char *result;
   char del_const[2];
  };

  short  pool_err;
  struct local_stack_def *l;

  #pragma nowarn (30)
  l  = POOL_GETSPACE_(i_exit_cb->Pool_addr,sizeof(struct local_stack_def),&pool_err );
  #pragma warn
  if (pool_err != 0)
  {
   exit(EXIT_FAILURE);
  }
  l->x = 1;
  l->cmd_match=0;
  *l->db_len = 0;
  l->db_cmd = g->db_cmd;
  l->imp_eulm= 1;
  #pragma nowarn (207)
  strncpy(l->del_const,"~",2);
  #pragma warn


   l->result = strtok( g->db_cmd,l->del_const);
   strcpy(l->db_cmd,l->result);
  • 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-24T11:33:03+00:00Added an answer on May 24, 2026 at 11:33 am

    strtok loops through the string it is tokenizing and replaces the delimiter characters with '\0'. So, if g->db_cmd points to a read-only string literal your strtok call will crash.

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

Sidebar

Related Questions

char *strtok(char *s1, const char *s2) repeated calls to this function break string s1
I have a function using strtok like this void f1(char *name) { ... char
strtok wont work correctly when using char *str as the first parameter (not the
I'm out of ideas! If I do this: string strTo = email1@domain.com; string strFrom
the program for strtok given on http://www.opengroup.org/onlinepubs/000095399/functions/strtok.html crashes everytime.. #include <string.h> ... char *token;
I am trying the strtok in visual c++, but it seems not working. This
I've not used strtok before, the PHP manual doesn't give a very good explanation.
XXX----Yep, its a Homework problem, but yea I'm stuck. Why doesn't this print out
I am having trouble with the strtok function. I keep getting a 'bus error.'
I have this bit of code: second = strtok (NULL,\n); logprintf(second); if(_stricmp(second,WINDOWS) == 0)

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.