简体   繁体   English

quickfix:如何将FIX :: Account转换为c_string或其他类型

[英]quickfix: how to convert FIX::Account to a c_string or other types

I am using quickfixengine to build a FIX application. 我正在使用quickfixengine构建FIX应用程序。 quickfix almost has no documentation, pretty much like a blackhole. quickfix几乎没有文档,就像一个黑洞。 I have a variable which is a FIX::Account type. 我有一个FIX::Account类型的变量。 I know it is a FIX string type, but how do I get the string out (to be a c-string). 我知道这是一种FIX字符串类型,但是如何将字符串取出(作为C字符串)。 I tried something like this, it does not pass the compilation. 我尝试过这样的事情,它没有通过编译。

FIX::Account acct;

// populate  acct somewhere else

printf(acct.c_str());

Compiler error is error: 'class FIX::Account' has no member named 'c_str' 编译器错误是错误:“类FIX :: Account”没有名为“ c_str”的成员

basically, I'd like to know how to get to know the constructor, interface of every FIX types? 基本上,我想知道如何了解每种FIX类型的构造函数,接口? which files contain these? 哪些文件包含这些文件?

thank you 谢谢

I assume you're using the C++ API. 我假设您正在使用C ++ API。 In this case, all fields inherit from FIX::FieldBase which has a convenient getString() method (see here ). 在这种情况下,所有字段都继承自FIX::FieldBase ,后者具有便捷的getString()方法(请参见此处 )。

I agree that is not easy to understand at a glance the declarations of FIX fields. 我同意,乍一看FIX字段的声明并不容易理解。 That's because all classes related to FIX messages are directly generated from the XML specifications of the FIX protocol. 这是因为与FIX消息相关的所有类都是直接从FIX协议的XML规范生成的。

getValue() method should be used for getting string fields. 应该使用getValue()方法获取字符串字段。 printf(acct.getValue().c_str()); 的printf(acct.getValue()c_str());

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM