ftp.nice.ch/pub/next/developer/objc/appkit/NeXTWORLD_DragLab.4.0.s.tar.gz#/NeXTWORLD_DragLab/Text_Console.m

This is Text_Console.m in view mode; [Download] [Up]

#import "Text_Console.h"
#import <stdarg.h>

@implementation Text(Text_Console)
#define BUFFERSIZE 512

- (int) printf:(const char *) format, ...
{
  int result, length = [self textLength];
  char buffer[BUFFERSIZE];
  va_list	ap;
  
  va_start(ap, format);
  result = vsprintf(buffer, format, ap);
  va_end(ap);

  // this is how one puts text into a Text object and goes to that selection.

  // put the cursor in the very last location and push the buffer in
  [[self setSel:length :length] replaceSel:buffer];

  // scroll so that it is visible and redisplay
  [[self scrollSelToVisible] display];
  
  return result;
}
@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.