473,320 Members | 2,117 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,320 software developers and data experts.

Constant string problem

I have a problem with a header file which was written in C++ which I
need to implement in C#.

The header file in C++ IS something like this,
........

#ifdef __cplusplus
extern "C" {

void WINAPI _libmain ( long JobNo );
void * WINAPI _getjobfield ( void *vJobRec, short field, short
subfield );

};
#endif

#define JF_CITY 91
#define JF_FLEET_INITIAL 92
#define JF_UFLEET_SELECT 93
#define JF_CARFLEET 94
#define JF_UDISPATCHNUMBER 95
#define JF_MIN_FARE 96
#define JF_EXTRAS 97
#define JF_OFFLOADJOBNO 98
#define JF_NAME 99
........
#define GETJF_NAME( JR ) ( ( char * )_getjobfield ( JR, JF_NAME,
0 ) )
#define GETJF_ACCOUNT( JR ) ( ( char * )_getjobfield ( JR,
JF_ACCOUNT, 0 ) )
#define GETJF_PHONE( JR ) ( ( char * )_getjobfield ( JR,
JF_PHONE, 0 ) )
#define GETJF_CONTACT( JR ) ( ( char * )_getjobfield ( JR,
JF_CONTACT, 0 ) )
......

I need to simulate this behaviour in C#. aS YOU CAN SEE for example I
have defined JF_NAME to be 99.
And also the methods are defined as Macros like,

GETJF_NAME( JR ) to be ( ( char * )_getjobfield ( JR, JF_NAME, 0 ) )
here JF_NAME should refer to 99 and

and JR is the value we are passing in.

Does anyone have an idea how to do this.

Thanks
Nov 15 '05 #1
1 1096
"James" <ja*****************@yahoo.com.au> wrote in message news:e6*************************@posting.google.co m...
have defined JF_NAME to be 99.
private const int JF_NAME = 99;
And also the methods are defined as Macros like,


AFAIK, there is not replacement for Macros, you should probably just define functions.

--
Michael Culley
Nov 15 '05 #2

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

Similar topics

3
by: Robert | last post by:
Hi, I am kinda new to c and i've encountered a problem with program because i need to change a constant. I ofcourse don't want to change a constant so is there any way to convert a constant to a...
3
by: Robert | last post by:
Hi, I am kinda new to c and i've encountered a problem with program because i need to change a constant. I ofcourse don't want to change a constant so is there any way to convert a constant to a...
10
by: Steve Pope | last post by:
The first of the following functions compiles, the second gives what I think is a spurious error: "cannot convert `const char' to `char *' in assignment". void foo(int m) { char *str; if (m...
25
by: galapogos | last post by:
Hi, I'm trying to compare an array of unsigned chars(basically just data without any context) with a constant, and I'm not sure how to do that. Say my array is array and I want to compare it with...
8
by: Stefano Sabatini | last post by:
Hi all, I'm encountering this while trying to implement a factory singleton method to generate objects. The singleton has a static map which binds a static creation function defined in each...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.