??? 05/24/12 05:27 Read: times |
#187485 - const strings in C |
Hello,
Probably i'm on wrong way, so let me ask. I want to define in one file many strings/messages as: const char msg1="hello"; ..... const char msg255="good bye!"; I need these to be in one file for easy changing, code-table pre-recoding , language changing... Problem is how to declare these in many modules. /* For varables i use DATADECLARE.H file as follow: MYDEF char variable1; In one DATADEFINE.C file i have #define MYDEF extern #include "DATADECLARE.H" In other modules - #define MYDEF ' ' #include "DATADECLARE.H" */ I tryed MYDEF const char msg1 MYDEF2 "hello1"; but stoped unsuccessfully on defining MYDEF2. What is right approach to do this with constant strings? regards |
Topic | Author | Date |
const strings in C | 01/01/70 00:00 | |
Does not compile | 01/01/70 00:00 | |
my question was | 01/01/70 00:00 | |
Common to play with #define EXTERN | 01/01/70 00:00 | |
Common doesn't mean recommended | 01/01/70 00:00 | |
well I recommend it | 01/01/70 00:00 | |
No - not hard to maintain at all | 01/01/70 00:00 | |
C strings | 01/01/70 00:00 | |
Whats wrong with a header file? | 01/01/70 00:00 | |
nothing wrong, double work | 01/01/70 00:00 | |
It works, and has advantages | 01/01/70 00:00 | |
I got in a total absolute magnificent mess | 01/01/70 00:00 | |
thanks to everyone, and next question is | 01/01/70 00:00 | |
about (tables of) pointers to const strings | 01/01/70 00:00 | |
C++ and style | 01/01/70 00:00 |