ATTENTIONThis FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices. |
flexsim.com |
#1
|
|||
|
|||
Passing variables to a C++ node
Hi,
Might be that I am not finding it in the documentation, but how do you pass parameters to a c++-toggled node in Flexsim? My code tries to replace the built in stringtoken function as it ignores delimiters after each other and I need to know if there is an empty column, i.e. two or more delimiters after each other, in the input data. I do not seem to be able to pass the parameters to the function. When compiling I get errors like the ones below, probable due to wrong definitions of the function: all.cpp(7335) : error C2062: type 'char' unexpected all.cpp(7342) : error C2065: 'str' : undeclared identifier all.cpp(7343) : error C2065: 'str' : undeclared identifier all.cpp(7356) : error C2440: 'return' : cannot convert from 'char *' to 'double' I want a function that behaves as a c-function "stringtokenSingleDelimiter(char * str, char const * delims){..." Now my user code has that name and those parameters (char * str and char const *) and I was planning on calling it that way. Any help on clarifying the issue would be appreciated! Thank you! Axel My code is currently: Code:
#include <stdio.h> #include <string.h> //C++ edition char * char * str = parstr(1); char const * delims = parstr(2); static char * src = NULL; char * p, * ret = 0; if (str != NULL){ src = str; } if (src == NULL){ return NULL; } if ((p = strpbrk (src, delims)) != NULL) { *p = 0; ret = src; src = ++p; } return ret; |
Tags |
c++, stringtoken |
Thread | Thread Starter | Forum | Replies | Last Post |
operators passing one another on network node | danielle paniccia | Q&A | 1 | 07-07-2013 04:10 PM |
How to set dynamicaly closing node edge in a network node | Preethi Sivaramakrishnan | Tips and Tricks | 8 | 06-27-2013 01:35 PM |
Non Passing for TEFlowitem | Sung Kim | Q&A | 0 | 05-24-2013 09:51 AM |
Passing parameters in executefsnode | Sung Kim | Q&A | 2 | 06-01-2010 09:37 AM |
Passing strings into a usercommand | Nico Zahn | Q&A | 6 | 01-13-2010 11:20 AM |