转换成字符串函数?

时间:2013-12-11 06:03:51

标签: c++ stream inputstream

有谁知道如何将此功能转换为字符串而不是打印到CMD?

    printf("RECV: [%0.2d:%0.2d:%0.2d:%0.2d] TRADE [symbol:%s last:%0.*f]\n",
    pUpdate->lastDateTime.hour, pUpdate->lastDateTime.minute, pUpdate-    >lastDateTime.second, pUpdate->lastDateTime.milliseconds,
    Helper::ConvertString(pUpdate->symbol.symbol, _countof(pUpdate->symbol.symbol)).c_str(),
    pUpdate->lastPrice.precision, pUpdate->lastPrice.price);

喜欢

结合的最后价格,符号和时间函数(pUpdate-> lastDateTime.hour,pUpdate-> lastDateTime.minute,pUpdate-> lastDateTime.second,pUpdate-> lastDateTime.milliseconds)将显示一串即09:09:09:0999 ??? 我之前发布的时候,我认为我有解决方案,但它失败了。我想看看是否有人能想出更好的解决方案。功能流数据。这就是我想出来的。

//如果我们获得符号的更新,我们会更新相应的sli ....

    }
string synbol1;
string  sli1;// sli1..2..etc will hold a single symbol
string sli2;
string sli3;
string sli4;
/*virtual*/ void Streamer::OnATStreamTradeUpdate(LPATQUOTESTREAM_TRADE_UPDATE pUpdate)
{

    Helper::ConvertString(pUpdate->symbol.symbol, _countof(pUpdate->symbol.symbol)).c_str() == synbol1;


    if (synbol1 == sli1){
        pUpdate->lastDateTime.hour, pUpdate->lastDateTime.minute, pUpdate->lastDateTime.second, pUpdate->lastDateTime.milliseconds,
            pUpdate->lastPrice.precision, pUpdate->lastPrice.price;
                         }

    else if (synbol1 == sli2){
        pUpdate->lastDateTime.hour, pUpdate->lastDateTime.minute, pUpdate->lastDateTime.second, pUpdate->lastDateTime.milliseconds,
            pUpdate->lastPrice.precision, pUpdate->lastPrice.price;
    }
    else if (synbol1 == sli3)
    {
        pUpdate->lastDateTime.hour, pUpdate->lastDateTime.minute, pUpdate->lastDateTime.second, pUpdate->lastDateTime.milliseconds,
            pUpdate->lastPrice.precision, pUpdate->lastPrice.price;
    }
    else if (synbol1 == sli4)
    {
        pUpdate->lastDateTime.hour, pUpdate->lastDateTime.minute, pUpdate->lastDateTime.second, pUpdate->lastDateTime.milliseconds,
            pUpdate->lastPrice.precision, pUpdate->lastPrice.price;
    }    

0 个答案:

没有答案