PDA

View Full Version : output while executing should be redirected to text file



AnithaRagupathy
13th October 2007, 10:40
hi,
I am working in QT4.3.0 and i want to redirect the output of my exe into a textfile .I dont want to do this in console.I want to do it in my cpp file itself.
Thanks in advance

jpn
13th October 2007, 10:42
See qInstallMsgHandler() (http://doc.trolltech.com/latest/qtglobal.html#qInstallMsgHandler).

AnithaRagupathy
13th October 2007, 11:29
Actually i am using qt 's unit testing framework.I am not able to incorporate in my pgm.
Can i use QCoreapplication class and get the exe path and then process further..

my pgm is like this...
void x()
{
CopyDirectoryCommand *obj;
obj = new CopyDirectoryCommand("C:\\check","C:\\tmp1\\",
CopyDirectoryCommand::sCopyCallback,reinterpret_ca st<long>(obj));
Utils::sCopyDirectory("C:\\check","C:\\tmp\\",
CopyDirectoryCommand::sCopyCallback,reinterpret_ca st<long>(obj));
}

jpn
13th October 2007, 11:33
Then see QTestLib command line options (http://doc.trolltech.com/latest/qtestlib-manual.html#options):

-o filename
write output to the specified file, rather than to standard output
:)

EDIT: Btw,


my pgm is like this...
void x()
{
CopyDirectoryCommand *obj;
obj = new CopyDirectoryCommand("C:\\check","C:\\tmp1\\",
CopyDirectoryCommand::sCopyCallback,reinterpret_ca st<long>(obj));
Utils::sCopyDirectory("C:\\check","C:\\tmp\\",
CopyDirectoryCommand::sCopyCallback,reinterpret_ca st<long>(obj));
}

I don't see anything relevant to Qt in here. There's no single Qt class or function being used in this code snippet. What are you trying to tell us with this code?