Thanks it works, is this the right code to use?

Code:
#include <stdio.h>
#include <iostream>
#include <fstream>

using namespace std;


int main () 
{
  int i;
  int x;
  int y;
  int z;
  
  char str [80];
  FILE * pFile;
  FILE * pFile2;
  
  
  // Creating and Writing to file
  pFile = fopen ("aplus.txt", "w+");
  fprintf (pFile, "%s %d", "X =", 001);
  fprintf (pFile, "\n");
  fprintf (pFile, "%s %d", "Y =", 10000);
  fprintf (pFile, "\n");
  fprintf (pFile, "%s %d", "Z =", 21);
  fclose (pFile);

  // Getting from file
  pFile = fopen ("aplus.txt", "r");
  fscanf (pFile, "%s = %d", str, &i);
  x=i;
  fscanf (pFile, "%s = %d", str, &i);
  y=i;
  fscanf (pFile, "%s = %d", str, &i);
  z=i;
  fclose (pFile);

  cout<<x<<endl;
  cout<<y<<endl;
  cout<<z<<endl;
  
  //Sending wanted information to another created file
  pFile2= fopen ("aplus2.txt", "w+");
 ofstream file;
 file.open("aplus2.txt");
 file<<x<<endl<<y<<endl<<z<<endl;
 file.close();
 fclose (pFile);
  system("aplus.txt");
  system("aplus2.txt");
  return 0;
}