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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:41:19+00:00 2026-05-28T00:41:19+00:00

I’m posting this as a vent for my questions (I will have a multitude).

  • 0

I’m posting this as a vent for my questions (I will have a multitude). I decided it would be rather annoying to keep asking the same person one question at a time (said person is very busy), so I’ll be posting questions as I come across them in my project. If you feel like helping, please do, and I would greatly appreciate it!

Note: this means I’ll be updating this post frequently. Help is greatly, greatly appreciated as always.

EDIT so you guys want me to just keep posting different questions if I come across them? Of course I always do research before asking you guys, you talented group of men and women only get the most persistent of errors.

My first question:

I keep getting the error:

lvalue required as left operand of assignment

THE PURPOSE of this code is to copy the first n character up to ':'. For instance, if currentline is: "LABEL: .long 100" then GetLabelName would return "LABEL".

NOTE strncpy isn’t working for this. It returns the remaining characters after ignoring the first n characters instead of just returning the first n characters…

Here’s the code that’s causing the error:

char *GetLabelName(char *currentline){
   char *labelname[200];
   while((((*labelname)++)=(*currentline)++)!=':');
   return labelname;
}

Something is fishy about this code I guess, but I can’t figure out what. Any ideas?

  • 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-28T00:41:20+00:00Added an answer on May 28, 2026 at 12:41 am

    What I think you’re trying to do is extract/copy all of the characters in a string up until a certain point (':' or NUL) and return that buffer. If that’s the case, you’re going to need to dynamically allocate memory for the new string (you can’t return a local buffer allocated on the stack), and you should also take advantage of functions in <string.h> like strchr and memcpy.

    Here’s an alternative working example:

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    
    char *extract_string(char *str, char delim)
    {
       size_t len;
       char *new_str;
       char *delim_pos = strchr(str, delim);
    
       /* new string is the length from the start of the old string to the
        * delimiter, or if it doesn't exist, a copy of the whole string */
       if (delim_pos == NULL)
          return strdup(str);
    
       len = delim_pos - str;
       new_str = malloc(len + 1);
       memcpy(new_str, str, len);
       new_str[len] = '\0'; /* NUL terminate the new string */
    
       return new_str;
    }
    
    int main(void)
    {
       char *extracted1 = extract_string("some:string", ':');
       char *extracted2 = extract_string("no delimiter", ':');
    
       puts(extracted1);
       puts(extracted2);
    
       /* free the dynamically allocated buffers */
       free(extracted1);
       free(extracted2);
    
       return 0;
    }
    

    Output:

    some
    no delimiter
    

    If you don’t want to make a copy when the delimiter isn’t found, you could alternatively return NULL.

    Alternatively, if you don’t mind mangling your initial string, you could use strtok to extract tokens.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text

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.