// тутечки проблемма // тут сохраненине файла, бинарника char fname[255]; sprintf((char*)fname,"%s",file_name.toLocal8Bit().data()); fname = QDir::current().absolutePath() + "/" + "Результаты" + "/" + QDateTime::currentDateTime().toString("yyyy-MM-dd_hh-mm-ssss")+ ".bin"; if(file_name.isEmpty()) { qDebug() << "хпреньа11 печенька "; return; } char fname[255]; sprintf((char*)fname,"%s",file_name.toLocal8Bit().data()); FILE *fid=0; fid=fopen(fname, "wb"); qDebug() << "K" << obm->stor->K << "NT" << obm->stor->NT; if(fid) { fwrite(obm->stor->RE,sizeof(double),obm->stor->K*obm->stor->NT,fid); fwrite(obm->stor->IM, sizeof(double),obm->stor->K*obm->stor->NT,fid); fclose(fid); } else { qDebug() << "Error save Re & Im! " << fname; } qDebug() << "END"; 

fname C: /Works/contr_glsso1/Results/2016-08-16_12-06-0808.bin

Error save Re & Im! C: /Works/contr_glsso1/Results/2016-08-16_12-06-0808.bin this is how it works.

I am writing in qt for this I think I can write to the file via QFile, but they told me that it is not correctly written.

Closed due to the fact that off-topic participants lexxl , user207618, Streletz , user194374, Ivan Pshenitsyn 17 Aug '16 at 11:40 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • “Questions asking for help with debugging (“ why does this code not work? ”) Should include the desired behavior, a specific problem or error, and a minimum code for playing it right in the question . Questions without an explicit description of the problem are useless for other visitors. See How to create minimal, self-sufficient and reproducible example . " - lexxl, Community Spirit, Streletz, Community Spirit, Ivan Pshenitsyn
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • This is called not "not working", but "not going." And your conversion to the error has nothing to do with, look at which line the compiler swears. - Vladimir Martyanov

1 answer 1

  fname = QDir::current().absolutePath() + "/" + "Результаты" + "/" + QDateTime::currentDateTime().toString("yyyy-MM-dd_hh-mm-ssss")+ ".bin"; 

In general, the problem in the language, replacing the directory name with the English works great.

Example:

  fname = QDir::current().absolutePath() + "/" + "DDR" + "/" + QDateTime::currentDateTime().toString("yyyy-MM-dd_hh-mm-ssss")+ ".bin"; 
  • one
    it is logical, because toLocal8Bit and Cyrillic are tricky friends. In fact, there are such perversions in your code that you don't even want to comment. - KoVadim