cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Pilgrim

Pointer to an array inside a structure

Hi!

I'm trying to make a pointer to an array in order to initialize the structures contained within, but
I keep obtaining a mismatch error 0x80020005.

The array is contained in another struct.

Here is the code:


// Constants
#define MAX_PARAMS 10

// Types
typedef COMMANDLINEPARAM_TYPE
begin
STRING original(MAX_PATH);
STRING name(MAX_PATH);
STRING value(MAX_PATH);
end;

typedef COMMANDLINE_TYPE
begin
STRING full_path(MAX_PATH*2); // Executable "C:\Gerbo\Virus.exe" (no quotes included)
COMMANDLINEPARAM_TYPE params(MAX_PARAMS); // Parameters
NUMBER num_params; // Number of parameters filled
end;

// Prototypes
export prototype object CommandLine_Decompose(STRING);
prototype object _NewCommandLineParam();

// Functions
///**
//* Reads a command line like in desktop shortcuts and separates it in file
//* and parameters
//* @param szCommandLine The command line as taken from the desktop icon
//* @return the object that describes the command line(COMMANDLINE_TYPE) or null if fails.
//*/
function object CommandLine_Decompose(szCommandLine)
COMMANDLINE_TYPE comm_line_result; // The struct to be returned
COMMANDLINEPARAM_TYPE param;
COMMANDLINEPARAM_TYPE POINTER pParam;
LIST listCommand; // command and parameters
STRING svCurrentElement; // Temporary string
NUMBER nLoop; // Variable for iteration
LIST listParam; // Param and value
NUMBER nParamLoop; // Loop for listParam
NUMBER i;
begin
pParam = comm_line_result.params;
for i = 0 to (MAX_PARAMS - 1)
set param = _NewCommandLineParam();
pParam = &param;
pParam++;
endfor;
comm_line_result.num_params = 0;

...

end;

///**
//* Creates a struct of COMMANDLINEPARAM_TYPE
//* @return struct of COMMANDLINEPARAM_TYPE
//*/
function object _NewCommandLineParam()
COMMANDLINEPARAM_TYPE p;
begin
return p;
end;



Could somebody help me?

Thanks in advance!
Labels (1)
0 Kudos
1 Reply
Highlighted
Pilgrim

Re: Pointer to an array inside a structure

I also had this problem.
Anybody can help us/:confused:
0 Kudos