Hi,
How do we create and perform I/O operations on tmpfile() in C++.
I need to create a tempfile and input some data into it and then send this file through exim.
This is what I want to achieve
I get the following error message at compile time
the error seems to be because pFile is File * type, is there any workaround this.
I want to create a file on the fly and input some data and then email it through exim.
Appreciate any help in this regards.
Thanks,
Tewari.
How do we create and perform I/O operations on tmpfile() in C++.
I need to create a tempfile and input some data into it and then send this file through exim.
This is what I want to achieve
Code:
File *pFile;
pFile = tmpfile();
//some code to write to this tmpfile()
//calling exim like this
string adminemail = "admin@puremail.com";
string fromemail = "reports@puremail.com";
string mailcmd = "/usr/sbin/exim -bnq -v ";
string sym = "<";
const char * systemCallExec;
string mcmd = mailcmd + " " + adminemail + " " + fromemail +" " + sym + " " +pFile;
systemCallExec = mcmd.c_str();
system(systemCallExec);
Code:
error: no match for 'operator+' in 'std::operator+(const
std::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*) [with _CharT =
char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>](" ")
+ pFile'
the error seems to be because pFile is File * type, is there any workaround this.
I want to create a file on the fly and input some data and then email it through exim.
Appreciate any help in this regards.
Thanks,
Tewari.