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

  • Home
  • SEARCH
  • 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 136853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:00:50+00:00 2026-05-11T07:00:50+00:00

I am faced with the need to pull out the information in a string

  • 0

I am faced with the need to pull out the information in a string of the format ‘blah.bleh.bloh’ in ANSI C. Normally I would use strok() to accomplish this, but since I am getting this string via strtok, and strtok is not thread-safe, I cannot use this option.

I have written a function to manually parse the string. Here is a snippit:

for(charIndex=0; charIndex < (char)strlen(theString); charIndex++) {     if(theString[charIndex] == '.')     {         theString[charIndex] = '\0';         osi_string_copy_n(Info[currentInfoIndex], 1024, theString, charIndex + 1 );         currentInfoIndex++;         theString = &theString[charIndex + 1];     }     charIndex++; } 

As you can see, I try to find the first occurrence of ‘.’ and make note of the index of the character. Then I convert the ‘.’ to a null char and copy the first string to an array.

Then I want to change the pointer to start just after where the delimiter was found, essentially giving me a new shorter string.

Unfortunately I am getting an error on the line:

theString = &theString[charIndex + 1]; 

The error is:

error C2106: '=' : left operand must be l-value 

Why am I not allowed to move the pointer like this? Is my method flawed? Perhaps someone has a better idea for me to parse this string.

EDIT: In response to the comments, the declaration for theString is:

char theString[1024] = {0}; 

Also, I am guaranteed that theString will never be more than 1024 characters.

  • 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. 2026-05-11T07:00:51+00:00Added an answer on May 11, 2026 at 7:00 am

    Under the assumption that you defined theString as an array, try defining it as a pointer. When you declare a char variable as an array, you cannot later change its address.

    I am assuming you have a declaration similar to

    char theString[100]; 

    The easiest solution is to leave that declaration alone, and add another one:

    char *str = theString; 

    and then use str everywhere that you currently use theString.

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

Sidebar

Ask A Question

Stats

  • Questions 85k
  • Answers 85k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I'm going to ignore the one app per answer request:… May 11, 2026 at 5:11 pm
  • Editorial Team
    Editorial Team added an answer The update_attributes method is generally used to set the fields… May 11, 2026 at 5:11 pm
  • Editorial Team
    Editorial Team added an answer Hate to kill the idea so quickly, but it's not… May 11, 2026 at 5:11 pm

Related Questions

I'm faced with a situation that I think can only be solved by using
A bit of background first: I am using base code from a remote SVN
I am currently faced with a difficult sorting problem. I have a collection of
Fragile base class is one of the most common point that gets popped up

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.