473,402 Members | 2,053 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

putting quotes around macro

Hi,

I have a macro whose value is obtained from a combination of other
macros. E.g

#define ALL_TESTS \
INIT_TEST ("string one", 1) \
DEF_TEST("string two", 2)

Upon execution, the value of ALL_TESTS gets evaluated to something in
this format:

{"string one", 1, NULL}, {"string two", 2, NULL}

I want to cast the above into a string so that I can parse the string
and extract fields of interest. I tried #ALL_TESTS but this doesn't
seem to work.. Is there a way to get this working?

Thanks

Jul 13 '07 #1
2 3894
On Jul 13, 10:31 am, rpar...@gmail.com wrote:
Hi,

I have a macro whose value is obtained from a combination of other
macros. E.g

#define ALL_TESTS \
INIT_TEST ("string one", 1) \
DEF_TEST("string two", 2)
How are INIT_TEST and DEF_TEST defined?
>
Upon execution, the value of ALL_TESTS gets evaluated to something in
this format:

{"string one", 1, NULL}, {"string two", 2, NULL}

I want to cast the above into a string so that I can parse the string
and extract fields of interest. I tried #ALL_TESTS but this doesn't
seem to work.. Is there a way to get this working?
Please provide smallest possible code to demonstrate your question. It
helps more clear understanding of your problem (or requirement).

Mohan

Jul 13 '07 #2
rp*****@gmail.com wrote:
Hi,

I have a macro whose value is obtained from a combination of other
macros. E.g

#define ALL_TESTS \
INIT_TEST ("string one", 1) \
DEF_TEST("string two", 2)

Upon execution, the value of ALL_TESTS gets evaluated to something in
this format:

{"string one", 1, NULL}, {"string two", 2, NULL}

I want to cast the above into a string so that I can parse the string
and extract fields of interest. I tried #ALL_TESTS but this doesn't
seem to work.. Is there a way to get this working?
Not tested, but probably good:

#define STRINGIZE(s) STRINGIZE2(s)
#define STRINGIZE2(s) #s

#include <stdio.h>
....
printf("%s", STRINGIZE(ALL_TESTS));

--
Thad
Jul 13 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Mike Vieths | last post by:
I'm running into a problem when I try to run commands with os.execv. It seems to be putting quotation marks around each element of the list passed as its second argument. This is fine for the...
4
by: (PeteCresswell) | last post by:
Is his just a flat-out "No-No" or is there some workaround when it comes time for SQL searches and DAO.FindFirsts against fields containing same? I can see maybe wrapping the value searched for...
7
by: Tim Mulholland | last post by:
I have an issue i can work around, but i'm trying to figure out what i'm "supposed" to do. i have a line of HTML/ASP.NET code inside a repeater that is something like this <a...
7
by: Donlingerfelt | last post by:
I would like to download stock quotes from the web, store them, do calculations and sort the results. However I am fairly new and don't have a clue how to parse the results of a web page download....
2
by: drew007 | last post by:
Hi all I am looking to drop data into a table for export to a csv file for example see below. DoCmd.RunSQL "SELECT Temp11.RowNum As RowNum, " &_ "Replace(Temp11.studEnrolment1,',','') AS...
14
by: adam.timberlake | last post by:
This is a really basic question for all you people out there who know PHP. This is not a problem but just something I'm confused about. I was reading the article below and wondered why are normal...
1
by: maryanncanor | last post by:
Hi I would like to know if there is a macro that can export the data from a query to an output textfile that has NO QUOTES. If I run the concatenated query Expr1: & & & & & & & ...
4
by: RvGrah | last post by:
If I add "string args" to the Program.cs file so that there can be arguments passed when the program launches, how do I add those to a fixed desktop shortcut on my users' machines? And If I'm...
2
by: ncsthbell | last post by:
I am trying to construct a 'Copy' statement in Access 2000 vb that I will actually write out to create a .bat file. My problem is that I need to put quotes around the vcFileFrom and vcFileTo...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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
0
BarryA
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.