I am trying to copy the contents of one file to another in linux. I think my logic is correct but I don't understand what the error is.
My function take 3 parameters. The 3rd parameter is a string which is the file name from which content is supposed to be read.
#include<iostream>
#include <curses.h>
#include<fstream>
#include<stdio.h>
#include<stdlib.h>
#include<string>
void process(int cvar, int cclause, string fnm)
{
    ifstream fs;
    ofstream ft;
    fs.open("contents.txt");
    if(!fs)
    {
        cout<<"Error in opening source file..!!";
    }
    ft.open(fnm,ios::app);
    if(!ft)
    {
        cout<<"Error in opening target file..!!";
        fs.close();
    }
char str[255];
while(fs.getline(str,255))
{
    ft<<str;
}
    cout<<"File copied successfully..!!";
    fs.close();
    ft.close();
    getch();
}
And this is the error I am getting:
g++ mainProj.cpp -lz3
/tmp/ccLBpiRs.o: In function `process(int, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
mainProj.cpp:(.text+0x172): undefined reference to `stdscr'
mainProj.cpp:(.text+0x17a): undefined reference to `wgetch'
collect2: error: ld returned 1 exit status
 
     
     
    