/*Inlcusion of header files*/
#include <iostream>
#include <fstream>
#include <string>

/*Use of namespace to provide access to the functions in the collection*/
using namespace std;

/*Prototype of the function to be used for file manipulation*/
void AmendFile(char* path);


int main()
{
    /*Call the amendfile function*/
    AmendFile("test.txt");
    return 0;
}


void AmendFile(char* path)
{
    /*Create the file stream pointer*/
    fstream fs;
    /*Temporary buffer*/
    char tmp[10];
    /*Open the file for reading*/
    fs.open(path,fstream::in);
    /*Read one line of (10) characters*/
    fs.getline(tmp,10,'\n');
    /*Get the current position of the file pointer*/
    streampos stpos=fs.tellg();
    /*Close the access to the file pointer*/
    fs.close();


    /*Open the file pointer for write access*/
    fs.open(path,fstream::out| fstream::app);
    /*Set the file pointer to the position recorded previously*/
    fs.seekg(stpos);
    /*Write the given number of bytes back to the file stream at the given position*/
    fs.write("\t34.21",5);
    /*Close the file pointer*/
    fs.close();
}