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 CCS Technical Support

string pointer question

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



Joined: 23 Apr 2009
Posts: 42

View user's profile Send private message

string pointer question
PostPosted: Fri Mar 29, 2013 6:50 am     Reply with quote

void printdatatoserialport( char *str)
void main (void)
{

printdatatoserialport("HELLO WORLD");
printdatatoserialport("Line 2");
printdatatoserialport("BYBY");

}

void printdatatoserialport( char *str)
{
fprintf(NETWERK,str);
}



Error 90 "test.c" Line 2476(35,36): Attempt to create a pointer to a constant


is there a way to solve this problem?
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Fri Mar 29, 2013 8:22 am     Reply with quote

Try this link.

http://www.ccsinfo.com/forum/viewtopic.php?t=48456&start=

It might either help or explain.

Mike
Ttelmah



Joined: 11 Mar 2010
Posts: 19539

View user's profile Send private message

PostPosted: Fri Mar 29, 2013 8:41 am     Reply with quote

Easiest one for what he wants is just:

#device PASS_STRINGS=IN_RAM

Add this to your code immediately after the processor define file is loaded. This will tell the compiler to generate a 'RAM buffer' for const strings, and automatically transfer them using this (which then allows pointers to be constructed).

The thread Mike points to and it's links will explain 'why'.

Best Wishes
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