Autor Beitrag
Flamefire
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1207
Erhaltene Danke: 31

Win 10
Delphi 2009 Pro, C++ (Visual Studio)
BeitragVerfasst: Fr 29.10.10 23:17 
Ich habe folgenden Code, der Log-Einträge ausgibt in C
ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
void RTMP_Log(int level, const char *format, ...)
{
  va_list args;
  va_start(args, format);
  cb(level, format, args);
  va_end(args);
}

Und Als Default Callback:
ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
static void rtmp_log_default(int level, const char *format, va_list vl)
{
  char str[MAX_PRINT_LEN]="";

  vsnprintf(str, MAX_PRINT_LEN-1, format, vl);

  if ( !fmsg ) fmsg = stderr;

  fprintf(fmsg, "%s: %s\n", levels[level], str);
  fflush(fmsg);
}

Das ganze steckt compiliert in einer DLL, die ich verwende.
Die Callback funktion kann ich umleiten, damit meine aufger wird.
Type ist: TRTMP_LogCallback=procedure(level:Integer; fmt:PAnsiChar; va_list:Pointer); stdcall;

Meine Frage: Wie kann ich die Ausgaben wie in C formatiert ausgeben?
In fmt steht so was:
Zitat:
Parsed protocol: %d
oder:
Parsed app : %.*s

und vl ist ein mir unbekannter Typ. Am Ende scheitert es aber daran, dass ich in Delphi keine gleiche Formatfunktion kenne.
delfiphan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2684
Erhaltene Danke: 32



BeitragVerfasst: Sa 30.10.10 00:09 
Vielleicht die hier:
msdn.microsoft.com/e...ms647551(VS.85).aspx

oder die hier:
ausblenden Delphi-Quelltext
1:
function wsprintf(Output: PChar; Format: PChar): Integer; cdeclvarargsexternal user32 name {$IFDEF UNICODE}'wsprintfW'{$ELSE}'wsprintfA'{$ENDIF};