I have a strange problem that may be created by my lack of C/C++ skills.

Starting from QStrings, I create two C strings that are passed to a Fortran subroutine. On my Windows 7 machine this works fine - almost all the time. But on a colleagues Windows 10 machine the strings are corrupted every time.

Here is the declaration of the Fortran subroutine in a DLL:

void execute(int *,char *, int *,char *, int *, int *);

Here is the summary of what I'm doing in the Qt code:

QString qsrt1, qstr2;
char *cstr1, *cstr2;
...
QByteArray ba = qstr1.toLocal8Bit();
cstr1 = ba.data();
ba = qstr2.toLocal8Bit();
cstr2 = ba.data();
...
execute(&ncpu,str1,&len1,str2,&len2,&res);

The Fortran code is correct, but on one machine the strings str1 and str2 appear as non-printing characters - random memory, I suspect.
What makes it very hard to debug is the fact that I almost never see the problem on my old W7 system; I thought it never happened, but then after running the program more than 20 times I got the corrupted string error. There is always the possibility that the problem is elsewhere in the Qt code, but I want to check that I'm not making a mistake with the string conversion. One question is whether I should be using const char * rather than char *.

Thanks.