473,327 Members | 1,952 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,327 software developers and data experts.

Pointer in a structure

I am trying to port a c structure for use in VB.NET. Note the char
*target_name. I know it is just a 4 byte pointer, as I use PCHAR in delphi
and it works. If I made it a pointer, how do a get it to point to the
varaible that contains the target.(ex. C:\temp\itemqty.txt) Thanks in
advance for any help.

struct rsubmit_parms
{
int size; /* REQUIRED Size of structure */
char hostname[101]; /* REQUIRED Name or IP address of host machine (if
none given, */
/* uses the name from
CHAINLNK.INI) */
char contents_code[4]; /* OPTIONAL Contents code (BIN, TXT) */
char filename[_MAX_PATH]; /* REQUIRED Path of file to submit. */
char object_title[51]; /* OPTIONAL Object title */
long record_count; /* OPTIONAL Record count */
int record_len; /* OPTIONAL Record length */
char ref_id_1[11]; /* REQUIRED Reference ID 1 */
char ref_id_2[31]; /* OPTIONAL Reference ID 2 */
char old_system_password[11]; /* RESERVED */
char old_system_user[11]; /* RESERVED */
char *target_name; /* REQUIRED Target name(s). Multiple targets can be
specified, */
/* seperated by commas. */
/* NOTE: This is a pointer, not a char array! Do not copy to this
location. */
char target_resp_code[4]; /* OPTIONAL Target response code (NON, DEL) */
char original_file_name[31]; /* OPTIONAL Filename of submitted file. */
char xmit_immediate; /* REQUIRED Y = xmit immediate, N = xmit regular. */
char target_action[81]; /* OPTIONAL Target action name */
char target_object_name[81]; /* OPTIONAL Target action name */
char begin_date[11]; /* OPTIONAL Date to send request */
char begin_time[9]; /* OPTIONAL Time to send request */
char system_password[101]; /* REQUIRED User password (if none given, uses
the name from CHAINLNK.INI) */
char system_user[101]; /* REQUIRED User name (if none given, uses the name
from CHAINLNK.INI) */
char system_select[11]; /* OPTIONAL System alias to use for authentication
*/
}
Jan 12 '06 #1
3 1338
AFAIK in VB.NET you can use the object type to pint to anything as all types
are inherited from Object
You then refer directly (not using anything like->) but you have to use
ctype() function
hth,
Shmuel Shulman


"Bob Simoneau" <bo*********@newsgroups.nospam> wrote in message
news:OO****************@TK2MSFTNGP15.phx.gbl...
I am trying to port a c structure for use in VB.NET. Note the char
*target_name. I know it is just a 4 byte pointer, as I use PCHAR in delphi
and it works. If I made it a pointer, how do a get it to point to the
varaible that contains the target.(ex. C:\temp\itemqty.txt) Thanks in
advance for any help.

struct rsubmit_parms
{
int size; /* REQUIRED Size of structure */
char hostname[101]; /* REQUIRED Name or IP address of host machine (if
none given, */
/* uses the name from
CHAINLNK.INI) */
char contents_code[4]; /* OPTIONAL Contents code (BIN, TXT) */
char filename[_MAX_PATH]; /* REQUIRED Path of file to submit. */
char object_title[51]; /* OPTIONAL Object title */
long record_count; /* OPTIONAL Record count */
int record_len; /* OPTIONAL Record length */
char ref_id_1[11]; /* REQUIRED Reference ID 1 */
char ref_id_2[31]; /* OPTIONAL Reference ID 2 */
char old_system_password[11]; /* RESERVED */
char old_system_user[11]; /* RESERVED */
char *target_name; /* REQUIRED Target name(s). Multiple targets can be
specified, */
/* seperated by commas. */
/* NOTE: This is a pointer, not a char array! Do not copy to this
location. */
char target_resp_code[4]; /* OPTIONAL Target response code (NON, DEL) */
char original_file_name[31]; /* OPTIONAL Filename of submitted file. */
char xmit_immediate; /* REQUIRED Y = xmit immediate, N = xmit regular. */
char target_action[81]; /* OPTIONAL Target action name */
char target_object_name[81]; /* OPTIONAL Target action name */
char begin_date[11]; /* OPTIONAL Date to send request */
char begin_time[9]; /* OPTIONAL Time to send request */
char system_password[101]; /* REQUIRED User password (if none given, uses
the name from CHAINLNK.INI) */
char system_user[101]; /* REQUIRED User name (if none given, uses the
name from CHAINLNK.INI) */
char system_select[11]; /* OPTIONAL System alias to use for
authentication */
}

Jan 12 '06 #2
Bob,
I am trying to port a c structure for use in VB.NET. Note the char
*target_name. I know it is just a 4 byte pointer, as I use PCHAR in delphi
and it works. If I made it a pointer, how do a get it to point to the
varaible that contains the target.(ex. C:\temp\itemqty.txt)


If you change its type to a String it should be straight forward to
do.
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Jan 12 '06 #3
That did it just greats, Thanks

"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:uJ****************@TK2MSFTNGP09.phx.gbl...
Bob,
I am trying to port a c structure for use in VB.NET. Note the char
*target_name. I know it is just a 4 byte pointer, as I use PCHAR in
delphi
and it works. If I made it a pointer, how do a get it to point to the
varaible that contains the target.(ex. C:\temp\itemqty.txt)


If you change its type to a String it should be straight forward to
do.
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Jan 12 '06 #4

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

Similar topics

20
by: j0mbolar | last post by:
I was reading page 720 of unix network programming, volume one, second edition. In this udp_write function he does the following: void udp_write(char *buf, <everything else omitted) struct...
6
by: Fernan Bolando | last post by:
What is the best way of passing a structure to a function currently I do by it passing a pointer to the structe. sample code below int main() { struct sample_struct a_struct, *point_struct;...
11
by: x-pander | last post by:
given the code: <file: c.c> typedef int quad_t; void w0(int *r, const quad_t *p) { *r = (*p); }
9
by: Juggernaut | last post by:
I am trying to create a p_thread pthread_create(&threads, &attr, Teste, (void *)var); where var is a char variable. But this doesnt't work, I get this message: test.c:58: warning: cast to pointer...
19
by: junky_fellow | last post by:
Can the size of pointer variables of different type may be different on a particular architecture. For eg. Can the sizeof (char *) be different from sizeof(int *) or sizeof (void *) ? What...
18
by: steve | last post by:
I'm trying to create a structure of three pointers to doubles. For which I have: typedef struct { double *lst_t, *lst_vc, *lst_ic; } last_values; I then need to allocate space for...
7
by: Kathy Tran | last post by:
Hi, Could you please help me how to declare an araay of pointer in C#. In my program I declared an structure public struct SEventQ { public uint uiUserData; public uint uiEvent; public uint...
13
by: aegis | last post by:
The following was mentioned by Eric Sosman from http://groups.google.com/group/comp.lang.c/msg/b696b28f59b9dac4?dmode=source "The alignment requirement for any type T must be a divisor of...
8
by: Sam | last post by:
I have a situation occuring in my code and I just can't see to figure out why I have an structure called employee that will put all of the employee id's into a char array set to 10 struct...
12
by: gcary | last post by:
I am having trouble figuring out how to declare a pointer to an array of structures and initializing the pointer with a value. I've looked at older posts in this group, and tried a solution that...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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: 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: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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: 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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.