Hello, I'm having trouble defining functions something like these:
uint CFileCsv::WriteElement(const enum value)
{
//--- checking
if(m_handle<0) return(0);
//---
if(!first) line.Append(delim);
line.Append(EnumToString(value));
first=false;
return StringLen(EnumToString(value));
}
enum keyword is not accepted. Using it breaks EnumToString function
uint CFileCsv::WriteElement(...)
{
// do something with var args ?
}"
You should use enum as enum.
For example,
ENUM_CHART_MODE cm = CHART_BARS;
string cs = EnumToString( cm);
Print( "Chart mode: " + cs);
// you get "CHARTS_BARS")
ENUM_POSITION_TYPE posType = POSITION_TYPE_BUY;
string ps = EnumToString( posType );
Print( "Position type: " + ps);
//you get "POSITION_TYPE_BUY"
You cannot define a generic function for enum, but you must specify the enum type.
For example, uint NewFunction( ENUM_POSITION_TYPE posType);
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello, I'm having trouble defining functions something like these:
uint CFileCsv::WriteElement(const enum value)
{
//--- checking
if(m_handle<0) return(0);
//---
if(!first) line.Append(delim);
line.Append(EnumToString(value));
first=false;
return StringLen(EnumToString(value));
}
enum keyword is not accepted. Using it breaks EnumToString function
uint CFileCsv::WriteElement(...)
{
// do something with var args ?
}