[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Segmentation fault running .oct file
From: |
Vision |
Subject: |
Re: Segmentation fault running .oct file |
Date: |
Mon, 14 Mar 2016 07:45:34 -0700 (PDT) |
Sorry I wanted to simplify the problem, because I knew the code for reading
was correct.
I have found the problem, I forgot to write return octave_value_list.
But my next problem is that I try to write a value to the PLC and I get a
segmentation fault.
//code
#include "snap7.h"
#include <iostream>
#include <octave/oct.h>
DEFUN_DLD(testread, args, nargout,
"test writing to PLC")
{
int16_t MyDB[0]; // byte is a portable type of snap7.h
TS7Client *MyClient;
const int n = args(1).int_value();
MyDB32[0]=n;
//example what works
//int value;
//value=25;
//myDB[0]=value;
MyClient = new TS7Client();
MyClient->ConnectTo("192.168.0.100",0,2);
MyClient->DBWrite(32, 0, 2, &MyDB);
delete MyClient;
return octave_value_list ();
}
//End of code
args(1).int_value() seems to be the problem.
--
View this message in context:
http://octave.1599824.n4.nabble.com/Re-Segmentation-fault-running-oct-file-tp4675484p4675486.html
Sent from the Octave - General mailing list archive at Nabble.com.