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

How do I copy a string in ROM to Ram?

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



Joined: 23 Oct 2008
Posts: 29

View user's profile Send private message

How do I copy a string in ROM to Ram?
PostPosted: Fri Nov 28, 2008 5:43 am     Reply with quote

Hi all. Mcc18 has a function in string.h file called strcpypgm2ram() defined as:
Quote:

char *strcpypgm2ram (auto char *s1, auto const MEM_MODEL rom char *s2);

/** @name strcpyram2pgm
* The {\bf strcpyram2pgm} function performs a {\bf strcpy} where {\bf s1}
* points to program memory and {\bf s2} point to data memory.
* @param s1 pointer to destination in program memory
* @param s2 pointer to source in data memory
*/


In my LCD.c file I am using this function as:

strcpypgm2ram((char *)t_string,version);

where version is : rom const char version[] = "0_00";
and t_string is : unsigned char t_string[12];

How do I do that in CCS?

Regards
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Nov 28, 2008 8:46 am     Reply with quote

It's very simple. Use strcpy().


Code:
strcpy(t_string, version);
BlueTower



Joined: 23 Oct 2008
Posts: 29

View user's profile Send private message

PostPosted: Fri Nov 28, 2008 11:56 am     Reply with quote

Thanks I have done that before you reply. I should have reply earlier saying it's ok. Sorry.
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