Pointer in a structure

  • Thread starter Thread starter Bob Simoneau
  • Start date Start date
B

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
*/
}
 
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,
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
 
Back
Top