joeGrammar
Programmer
Does anyone see anything wrong with this code?
CALL:
printDetailLine(0,szLine,0);
(szLine is a zero-terminated string)
FUNCTIONS:
inline LOGIC Report:rintDetailLine( int dummy, ... )
{
va_list argptr;
LOGIC bStatus;
va_start( argptr, dummy );
bStatus = printDetailLine(columns, argptr);
va_end(argptr);
return bStatus;
}
(the next function is called from the dummy function)
inline LOGIC Report:rintDetailLine( ColumnList &columns, ... )
{
va_list argptr;
LOGIC bStatus;
va_start(argptr, columns);
bStatus = printDetailLine(columns, argptr);
va_end(argptr);
return bStatus;
}
LOGIC Report:rintDetailLine( ColumnList &columns, va_list argptr)
{
t_index iColumns = columns.columnList.GetElementCount();
for ( int iCount = 0; iCount < iColumns; iCount++ )
{
ChangeColParamString ( columns, szBuff, &argptr, iCount );
.....
void Report::ChangeColParamString ( ColumnList &columns, char *szParam, va_list* ValList, t_index iColumns )
{
szBuff = va_arg(*ValList, char*);
sprintf ( szParam, ColToStr.c_str(), szBuff );
}
The program crashed on the sprintf, even when I try to printf the szBuff it doesn't work. Any Ideas? Thanks in advance!
CALL:
printDetailLine(0,szLine,0);
(szLine is a zero-terminated string)
FUNCTIONS:
inline LOGIC Report:rintDetailLine( int dummy, ... )
{
va_list argptr;
LOGIC bStatus;
va_start( argptr, dummy );
bStatus = printDetailLine(columns, argptr);
va_end(argptr);
return bStatus;
}
(the next function is called from the dummy function)
inline LOGIC Report:rintDetailLine( ColumnList &columns, ... )
{
va_list argptr;
LOGIC bStatus;
va_start(argptr, columns);
bStatus = printDetailLine(columns, argptr);
va_end(argptr);
return bStatus;
}
LOGIC Report:rintDetailLine( ColumnList &columns, va_list argptr)
{
t_index iColumns = columns.columnList.GetElementCount();
for ( int iCount = 0; iCount < iColumns; iCount++ )
{
ChangeColParamString ( columns, szBuff, &argptr, iCount );
.....
void Report::ChangeColParamString ( ColumnList &columns, char *szParam, va_list* ValList, t_index iColumns )
{
szBuff = va_arg(*ValList, char*);
sprintf ( szParam, ColToStr.c_str(), szBuff );
}
The program crashed on the sprintf, even when I try to printf the szBuff it doesn't work. Any Ideas? Thanks in advance!