|
From: Per W. <pw...@ia...> - 2004-05-20 09:31:16
|
Defines don't scan strings, but you can make the substitution first and
then convert to a string:
#define TOSTRING(s) #s
#define MAXSTRING 256
#define MAXSTRINGNAME TOSTRING(MAXSTRING) ".ini"
printf("Filename: %s",MAXSTRINGNAME);
or just
strcat(iniFile,TOSTRING(MAXSTRING) ".ini");
Note also that the ## operator may be used by preprocessor to concatenate
two arguments, as:
#define CONCAT(a,b) a ## b
/Per W
On Thu, 20 May 2004, OROSZI Bal=E1zs wrote:
A.Buschh=FCter wrote:
> Hi,
> I have a problem, that shouldn't be a problem... ;)
> I've got a #define statement for the strings length, at the start of the
> file.
> It works like it should, but in this case:
>
> #define MAXSTRING 256
>
> void loadData(){
> char iniFile[MAXSTRING]; // replaced
> cIniEd tmp;
>
> strcpy(iniFile, projekt_Data.projekt_Path);
> strcat(iniFile, "MAXSTRING.ini"); // not replaced
> tmp.setPfad(iniFile);
>
> }
> [/code]
>
> I get always "MAXSTRING.ini", but it shou
|