CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

"LVALUE required"

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
mle
Guest







"LVALUE required"
PostPosted: Thu Jun 26, 2003 7:36 am     Reply with quote

Hello,
I have the following code in my main program:

void main(){
char line1[25], seconds[3], colon[2];
.
.
.
sprintf(colon,"\%c",':');
line1=strcat(seconds,colon); //ERROR HERE
.
.
}


I get an error on the 'strcat' line that says "LVALUE required".
What am I doing wrong?

Thanks,
mle
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515574
R.J.Hamlett
Guest







Re: "LVALUE required"
PostPosted: Thu Jun 26, 2003 7:47 am     Reply with quote

:=Hello,
:=I have the following code in my main program:
:=
:=void main(){
:=char line1[25], seconds[3], colon[2];
:=.
:=.
:=.
:=sprintf(colon,"\%c",':');
:=line1=strcat(seconds,colon); //ERROR HERE
:=.
:=.
:=}
:=
:=
:=I get an error on the 'strcat' line that says "LVALUE required".
:=What am I doing wrong?
:=
:=Thanks,
:=mle
'LVALUE required', implies that a value type is wrong. The fault, is that 'strcat', returns a pointer to a string, while line1, is allready defined, as a physical array (not a pointer). Though C allows you to use the name of an array as a pointer for the right hand side of an equation, doing it the other way round won't work.
Change your definition to:

char *line1, seconds[3], colon[2];

Best Wishes
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515575
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group