[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::digital_unix

Title:DIGITAL UNIX(FORMERLY KNOWN AS DEC OSF/1)
Notice:Welcome to the Digital UNIX Conference
Moderator:SMURF::DENHAM
Created:Thu Mar 16 1995
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:10068
Total number of notes:35879

9432.0. "vswprintf() / empty buffer" by SAPEC3::WALLMEROTH () Tue Apr 08 1997 14:52

    in re .1 I attach a small testprogram, which uses vswprintf().
    It seems that vswprintf() doesn't deliver anything into its
    buffer.
    
    Is something wrong with my program or have we found a bug in
    vswprintf() ?
    
    
    The output of the testprogram:
    
    deccc35:orao35> uname -a
    OSF1 deccc35 V4.0 564 alpha
    deccc35:orao35> tn
          direct: Hello, hello
    via vsprintf: Hello, hello
          direct: H e l l o, h e l l o
    via vswprintf: deccc35:orao35>
    
    Anything known ?
    Eckhardt
T.RTitleUserPersonal
Name
DateLines
9432.1SAPEC3::WALLMEROTHTue Apr 08 1997 14:5342
#include <stdarg.h>
#include <wchar.h>
 
void MyPrintf( const char *format, ...) {

  va_list ap;
  char buf[512];

  va_start( ap, format );
  vprintf( "      direct: " );
  vprintf( format, ap );
  va_end( ap );

  va_start( ap, format );
  vsprintf( buf, format, ap );
  printf( "via vsprintf: %s", buf );
  va_end( ap );
}
 
void MyWprintf( const wchar_t *format, ...) {

  va_list ap;
  wchar_t buf[512];

  va_start( ap, format );
  vwprintf( L"      direct: " );
  vwprintf( format, ap );
  va_end( ap );

  va_start( ap, format );
  vswprintf( buf, 128, format, ap );
  wprintf( L"via vswprintf: %S", buf );
  va_end( ap );
}
 
main( int argc, char** argv ) {
 
  MyPrintf( "%s%s\n", "Hello, ", "hello" );
  MyWprintf( L"%S%S\n", L"H e l l o, ", L"h e l l o" );

  exit( 0 );
}
9432.2NETRIX::&quot;[email protected]&quot;Bob FontaineThu Apr 10 1997 12:2213

Your code is fine but you have uncovered a bug in the vswprintf() 
routine.    Please file a Software Problem Report (SPR).


Bob





[Posted by WWW Notes gateway]
9432.3QAR #52446SAPEC3::WALLMEROTHFri Apr 11 1997 05:211
    Is a QAR also acceptable ?