Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!ima!haddock!karl From: karl@haddock.UUCP Newsgroups: comp.lang.c Subject: Re: Unstylish #defines ?? Message-ID: <1237@haddock.ISC.COM> Date: Thu, 24-Sep-87 19:19:51 EDT Article-I.D.: haddock.1237 Posted: Thu Sep 24 19:19:51 1987 Date-Received: Sat, 26-Sep-87 13:14:54 EDT References: <325@petro.UUCP> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Distribution: na Organization: Interactive Systems, Boston Lines: 12 Keywords: quotes, files Summary: Wait for ANSI In article <325@petro.UUCP> jrb@petro.UUCP (Jon Boede) writes: >#define FOO "/usr/me >stream = fopen(FOO/afile","r"); It isn't portable, and so it's best to avoid this. In pre-ANSI, the best you can do is paste the two pieces together at run-time (with strcat or sprintf), or #define each such path separately (#define FOO_afile "/usr/me/afile" , etc.), but in ANSI C string constants can be pasted at compile-time: #define FOO "/usr/me" stream = fopen(FOO "/afile", "r") Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint