Re: [Quickfix-developers] sample code to read price log file and resend
Brought to you by:
orenmnero
|
From: Djalma R. d. S. F. <drs...@gm...> - 2007-10-29 13:43:49
|
Hi Jitesh,
See if code bellow helps you. It reads a standard quickfix log file,
parses each line (ignoring admin messages) and send them to a target
session.
Djalma
----------------------------------------------------
std::ifstream file;
file.open(g_config.inputFile.c_str(), std::ios_base::in);
if (!file.is_open())
{
std::cout << "could not open file " << g_config.inputFile << std::endl;
exit(-1);
}
// read line by line
//std::string line;
CStdString line;
int lineno = 1;
//g_messagesToSend.clear();
// get session information
FIX::SessionID sessionID(
g_config.beginString,
!g_config.newSenderCompID.empty()?g_config.newSenderCompID:g_config.senderCompID,
!g_config.newTargetCompID.empty()?g_config.newTargetCompID:g_config.targetCompID);
const FIX::Session * const pSession = FIX::Session::lookupSession( sessionID );
ASSERT(NULL != pSession);
if (NULL == pSession) throw std::runtime_error(_T("SESSION NOT FOUND!"));
const FIX::DataDictionary * const pDD = pSession->getDataDictionary();
while (getline(file, line, '\n') )
{
// print the result
if ( !FIX::Message::isAdminMsgType( FIX::identifyType( line ) ) )
{
std::cout << line << std::endl << std::endl;
FIX::Message messageToSend(line, *pDD, true);
Session::sendToTarget(messageToSend, sessionID);
}
++lineno;
}
if (file.is_open())
file.close();
On 10/19/07, JiteshT <ji...@ed...> wrote:
> QuickFIX Documentation: http://www.quickfixengine.org/quickfix/doc/html/index.html
> QuickFIX Support: http://www.quickfixengine.org/services.html
>
>
> Hello,
>
> Does anyone have some sample code I can use to read a price message log
> file, and send out the read messages on a socket?
>
> thanks,
>
> Jitesh
> --
> View this message in context: http://www.nabble.com/sample-code-to-read-price-log-file-and-resend-tf4655439.html#a13301931
> Sent from the QuickFIX - Dev mailing list archive at Nabble.com.
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Quickfix-developers mailing list
> Qui...@li...
> https://lists.sourceforge.net/lists/listinfo/quickfix-developers
>
|