Home All Groups Group Topic Archive Search About

Pointer in a structure

Author
12 Jan 2006 7:03 PM
Bob Simoneau
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
*/
}

Author
12 Jan 2006 7:43 PM
S Shulman
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




Show quoteHide quote
"Bob Simoneau" <bobsimoneau@newsgroups.nospam> wrote in message
news:OO%23mMs6FGHA.2300@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 */
> }
>
>
Author
12 Jan 2006 7:48 PM
Mattias Sjögren
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.
Author
12 Jan 2006 8:14 PM
Bob Simoneau
That did it just greats, Thanks

Show quoteHide quote
"Mattias Sjögren" <mattias.dont.want.spam@mvps.org> wrote in message
news:uJm%23hF7FGHA.1288@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.