help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Segmentation fault running .oct file


From: Andreas Weber
Subject: Re: Segmentation fault running .oct file
Date: Mon, 14 Mar 2016 17:28:27 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.6.0

Am 14.03.2016 um 15:45 schrieb Vision:
> But my next problem is that I try to write a value to the PLC and I get a
> segmentation fault.
> ....
> DEFUN_DLD(testread, args, nargout,
>           "test writing to PLC")
>... 
>   const int n = args(1).int_value();
> args(1).int_value() seems to be the problem.

C++ arrays are indexed starting with 0 so the first param is args(0)

You should probably do something like
int nargin = args.length ();
and check nargin before trying to access it.

-- Andy



reply via email to

[Prev in Thread] Current Thread [Next in Thread]