Hello everyone,
I have a number of strings in an array,
"FILE1", "FILE2", "FILE3", ... , "FILEN"
I want to add the common prefix to all the string, like
(for example, the common prefix is "FOO")
"FOOFILE1", "FOOFILE2", "FOOFILE3", ... , "FOOFILEN".
Are there any smarter ways to use a macro to define all of them
altogether?
thanks in advance,
George 1 1298
In article
<78**********************************@w40g2000hsb. googlegroups.com>,
George2 <ge*************@yahoo.comwrote on Thursday 22 Nov 2007 1:29
pm:
Hello everyone,
I have a number of strings in an array,
"FILE1", "FILE2", "FILE3", ... , "FILEN"
I want to add the common prefix to all the string, like
(for example, the common prefix is "FOO")
"FOOFILE1", "FOOFILE2", "FOOFILE3", ... , "FOOFILEN".
Are there any smarter ways to use a macro to define all of them
altogether?
Yes. Just write "FOOFILE1", ..., instead.
Also adjacent string literals are concatenated by the compiler. Thus:
"FOO" "FILE2"
becomes
"FOOFILE2"
During runtime you can use sprintf() or strcat()/strncat() do to the
same as well. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: s |
last post by:
Can I do this:
#define MYSTRING "ABC"
..
..
..
char mychar = MYSTRING;
..
..
..
|
by: Dead RAM |
last post by:
Hey people, i'll try to keep this short ;)
Here is what I want to type (or at least close too)...
#define VER_BUILD 1
#define STR_VER_BUILD "VER_BUILD"
But what happends is...
|
by: Vittal |
last post by:
Hello All,
Here is a small C program,
main()
{
int a= 100;
float b =99.99;
TEST(a,%d);
TEST(b,%f);
|
by: pozz |
last post by:
Hi all,
I have the below #defines
#define NUMBER1 30
#define NUMBER2 50
#define SUM (NUMBER1+NUMBER2)
#define STRING1 "Byte: \x30"
#define STRING2 "Byte: \x50"...
|
by: Ancient_Hacker |
last post by:
It sure would be nice if I could have a macro that add a level of
indirection to its argument.
So if I write: AddIndirection( X )
The macro AddIndirection will do: #define X (*X)
...
|
by: Sensei |
last post by:
Hi! I'm concerned about the legality of such a definition:
#define funcX funcY
where funcX belongs to the *standard* C functions. Is it legal to do
this? The standard says "any function...
|
by: Mohammad Omer Nasir |
last post by:
I was read Linux kernel code in which I saw few define
macro defines in functions. The snap of the function is following and
file name "err_ev6.c".
static int
ev6_parse_cbox(u64 c_addr, u64...
|
by: anirbid.banerjee |
last post by:
Hi,
I need to write a macro which would have a lot many conditional
#ifdef ... #endif blocks in it.
#define _xx_macro (x) {
... \
... \ /* some code (); */
#ifdef _SOME_STMT \
... \
... \
|
by: raghu |
last post by:
Hello
I have a doubt plz clarify that
#ifndef SYSTEM_H
#define SYSTEM_H
what will be the value of SYATEM_H after this #define statement and
before that statement.
Thanking you all
Bye
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |