| Stefan Kanev 05/23/12 23:27 Read: 430 times Silistra Bulgaria |
#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 | Stefan KAnev | 05/23/12 23:27 |
| Does not compile | Maarten Brock | 05/24/12 02:05 |
| my question was | Stefan KAnev | 05/24/12 04:21 |
| Common to play with #define EXTERN | Per Westermark | 05/24/12 05:41 |
| Common doesn't mean recommended | Oliver Sedlacek | 05/25/12 09:43 |
| well I recommend it | Erik Malund | 05/25/12 10:13 |
| No - not hard to maintain at all | Per Westermark | 05/25/12 12:44 |
| C strings | Per Westermark | 05/24/12 03:00 |
| Whats wrong with a header file? | Oliver Sedlacek | 05/24/12 10:08 |
| nothing wrong, double work | Stefan KAnev | 05/24/12 11:04 |
| It works, and has advantages | Oliver Sedlacek | 05/25/12 07:06 |
| I got in a total absolute magnificent mess | Erik Malund | 05/25/12 07:58 |
| thanks to everyone, and next question is | Stefan KAnev | 05/25/12 14:46 |
| about (tables of) pointers to const strings | Stefan KAnev | 05/25/12 14:47 |
C++ and style | Maarten Brock | 05/26/12 03:57 |



