LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

more CIN help

Hi,

I am sorry to keep bothering, but I am having trouble now compiling my CIN,
because of a number of errors. I am not very knowledgable about how the value
of my string passes through, so I woudl appreciate any help I could get.
I am using Microsoft visual C++ 6.0, by the way.

Some key elements of my code are:

#include "extcode.h"

CIN MgErr CINRun(LStrHandle var1);

CIN MgErr CINRun(LStrHandle var1) {

void writecmd (char *s);

void main()
{
char *message;
message=var1;
initialize();
/* RESET THE PC21 */
writecmd(message);
}

void writecmd(char *s)
{
while (*s)
writech (*s++);
return;
}

void writech ( char alpha )
{
while (!(inp(address+1) & IDB_M));
outp (address,alpha);
outp (address+1, CHAR_READY);
whil
e (inp(address+1) & IDB_M);
outp(address+1,CB);
while (!(inp(address+1) & IDB_M));
return;
}



so, this code takes the string that I pass to the CIN, that string being
var1, and names it message, then runs the routine writecmd to write that
string, as the pointer goes along te string, until the end. However, this
doesnt work. In my compiler I get the error:
C:\Program Files\National Instruments\LabVIEW\Roa\move.c(44) : warning C4047:
'=' : 'char *' differs in levels of indirection from 'struct LStr ** '

so the LStr that was created by labview is a pointer to a pointer. However,
I have no clue how to then, baced upon my current code, give the string message
the value of var1, and then send it via writecmd. Any help is most appreciated.
I am not very familiar with CINs, so there lies the root of my probelm, and
I am only marginal familiar with C++, so I thank you for your help.

JMH
0 Kudos
Message 1 of 2
(2,725 Views)
I guess I keep sending you around in circles.
It is not intentionall, I have been out of C code for many years.
Take a look a extcode.h ans search for LStrHandle
It is actually a pointer to a pointer to a structure.
I believe this is pascal type strings but I am not sure.
The structure contains (from memory) a numeric of the
number of bytes in the string and an array for the string.
Look for further comments
JMH wrote:

> Hi,
>
> I am sorry to keep bothering, but I am having trouble now compiling my CIN,
> because of a number of errors. I am not very knowledgable about how the value
> of my string passes through, so I woudl appreciate any help I could get.
> I am using Microsoft visual C++ 6.0, by the way.
>
> Some key elements of my code are:
>
> #include "extcode.h
"
>
> CIN MgErr CINRun(LStrHandle var1);
>
> CIN MgErr CINRun(LStrHandle var1) {
>
> void writecmd (char *s);
>
> void main()
> {
> char *message;

This variable message needs to match the LStrHandle or you will
have to do more manipulations than the next line

> message=var1;
> initialize();
>

[snip]

>
>
> doesnt work. In my compiler I get the error:
> C:\Program Files\National Instruments\LabVIEW\Roa\move.c(44) : warning C4047:
> '=' : 'char *' differs in levels of indirection from 'struct LStr ** '
>

The error is caused by the diff between char *message and LStrHandle var1
Look at the docs for C++ and look at pointer dereferencing and dot notation
for structures. See also if there is a function to change from pascal strings
to C strings (this may be easier than coding it by hand if the function exists.)

You have just about exhausted my knowledge so I may leave off here.
Kevin Kent
0 Kudos
Message 2 of 2
(2,725 Views)