air4

I've created project for runtime and download it to my RPi. Now I want to count execution time of single program cycle. I also need to export stored measurements to .txt or .csv. First I started from adding simple code in main.cpp line 269 which purpose is export "2" to .txt file:

int n=2;
FILE *fptr = fopen("sample.txt", "w");
fprintf(fptr,"%d \n", n);
fclose(fptr);

I didn't get any result in my file sample.txt after starting runtime on RPi. Is it possible to export anything from main.cpp in this way? 
I also have problem with running the generated binary directly from the command line (it resides in OpenPLC_v3/webserver/core/openplc) - it doesn't open terminal.

Quote 0 0
thiagoralves
You need to compile a program for your changes to make effect. Just changing main.cpp won’t change the behavior of the currently compiled program. Just to clarify, here are the steps to compile a program:  https://www.openplcproject.com/reference/basics/upload
Quote 0 0
air4
Thank You - compilation solves the problem. The file is created in webserver folder instead of core folder.
Quote 0 0