Send string argument to KFlop C program

Moderators: TomKerekes, dynomotion

Post Reply
SamMarrocco
Posts: 85
Joined: Fri Apr 27, 2018 12:44 pm

Send string argument to KFlop C program

Post by SamMarrocco » Tue Jul 26, 2022 2:29 pm

I am planning to save the current backlash amount & direction to disk for persistence. My plan involves using a KFlop thread to run the C program(s) that save and load the values to disk. However, I'd like to determine the location of that file from my vb.net application if possible. Since the determination of the path for that file would be within the C code running on the KFlop, I would need a way to 'pass the path/file name' from my vb.net code to the KFlop C code/thread. I don't believe it is possible to pass an argument from the vb.net code to the C-Code upon execution.

Are there any examples of sending a string between vb.net and the KFlop C code in a running thread (perhaps persist variables) or another method of passing the path/file string to the KFlop?

The main reason I wish to change the path/file in the C Code is to keep my data sandboxed within my app's path, and the app itself is portable to that path can change.

User avatar
TomKerekes
Posts: 2529
Joined: Mon Dec 04, 2017 1:49 am

Re: Send string argument to KFlop C program

Post by TomKerekes » Tue Jul 26, 2022 6:40 pm

Hi Sam,

KFLOP has an 8 MByte gather_buffer that can be used for uploading/downloading blocks of data. The SimpleFormsCS is a C# example that downloads and uploads a block of data to the gather_buffer. You might look at that. See the function called:

Code: Select all

        private void TestUSB_Click(object sender, EventArgs e)

On the KFLOP side you might look in KflopToKMotionCNCFunctions.c at function:

Code: Select all

int GetEditControl(char *s, int Var, int offset)
which copies a string out of the Gather Buffer back to the caller.

HTH
Regards,

Tom Kerekes
Dynomotion, Inc.

SamMarrocco
Posts: 85
Joined: Fri Apr 27, 2018 12:44 pm

Re: Send string argument to KFlop C program

Post by SamMarrocco » Wed Jul 27, 2022 12:50 am

Thank you for the pointer, Tom. I'll look into using the gather buffer for this.

Post Reply