There is a code:

file = fopen (tmpkey, "wb"); if (file == NULL) printf ("ERROR: FileSystem\n"); // Запись дерева SaveTree(tree, file); // Закрытие файла fclose (file); 

And function:

 void SaveTree(struct avlleaf* tree, FILE * file){ if(tree == NULL) return; fwrite(tree->key, 1, sizeof(tree->key), file); fwrite(&tree->llupar, sizeof(unsigned long long int), 1, file); SaveTree(tree->right, file); SaveTree(tree->left , file); } 

It seems all the rules, but when, for example, instead of d.bin they write /d.bin

Logically should write:

ERROR: FileSystem Because he can not create a file in the root (no rights)

And he does not.

How to fix?

  • irrespective of this, but SaveTree writes ambiguously interpreted data - Andrio Skur
  • @AndrioSkur with this later ... For now, I need to learn how to catch the file creation error - Alrott SlimRG
  • So it means he can create it there, since there is no error. - NewView
  • No - can not: ( - Alrott SlimRG
  • one
    @AlrottSlimRG, about win (vista +) there is such a thing as UAC virtualization and in such a file should go somewhere in %USER_DIR%/AppData\Local\Virtual Store - I would have sinned about it ... That under normal linux you feel something like - I do not believe. until I see a full-fledged minimum reproducible example and output (with launch details) ... - Fat-Zer Nov.

0