This is chart2.m in view mode; [Download] [Up]
// testing of more of the Characters category.
#import <stdio.h>
#import <stdlib.h>
#import <signal.h>
#import <fcntl.h>
#import <string.h>
#import <sys/time.h>
#import <RCString.h>
int
main(int c, char **v)
{
RCString *oString;
int iChar, iIndex;
// args assumed to be: cmd string char index
iChar = *v[2];
iIndex = atoi(v[3]);
oString = [RCString newFromString:v[1]];
if (oString) {
printf("substituting %c at index %d into \"%s\": \"%s\"\n",
iChar, iIndex, v[1],
[[oString substituteCharacter:iChar at:iIndex] data]);
printf("inserting %c at index %d into \"%s\": \"%s\"\n",
iChar, iIndex, v[1],
[[[oString replaceWithAsciiString:v[1]] insertCharacter:iChar at:iIndex] data]);
[oString free];
} else {
fprintf(stderr, "newFromString: failure\n");
return(1);
}
return(0);
}
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.