468,736 Members | 2,018 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,736 developers. It's quick & easy.

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 1258
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

20 posts views Thread by j0mbolar | last post: by
6 posts views Thread by Fernan Bolando | last post: by
11 posts views Thread by x-pander | last post: by
9 posts views Thread by Juggernaut | last post: by
19 posts views Thread by junky_fellow | last post: by
18 posts views Thread by steve | last post: by
7 posts views Thread by Kathy Tran | last post: by
13 posts views Thread by aegis | last post: by
8 posts views Thread by Sam | last post: by
1 post views Thread by CARIGAR | last post: by
xarzu
2 posts views Thread by xarzu | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.