Changed cStringNoCopy to cString

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@3105 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 1998-10-23 12:14:28 +00:00
parent 25cfc35dab
commit dfca27ad7f
4 changed files with 17 additions and 7 deletions

View file

@ -1,4 +1,6 @@
/* A demonstration of writing and reading GNU Objective C objects to a file. */ /* A demonstration of writing and reading GNU Objective C objects to a file. */
// Fri Oct 23 03:01:09 MET DST 1998 dave@turbocat.de
// cStringNoCopy -> cString
#include <gnustep/base/Archiver.h> #include <gnustep/base/Archiver.h>
#include <gnustep/base/BinaryCStream.h> #include <gnustep/base/BinaryCStream.h>
@ -70,14 +72,14 @@ int main(int argc, char *argv[])
/* Read in the Array */ /* Read in the Array */
[archiver decodeObjectAt: &array withName: &name]; [archiver decodeObjectAt: &array withName: &name];
if (name) if (name)
printf ("got object named %s\n", [name cStringNoCopy]); printf ("got object named %s\n", [name cString]);
else else
printf ("got object named (unnamed)\n"); printf ("got object named (unnamed)\n");
/* Read in the Dictionary */ /* Read in the Dictionary */
[archiver decodeObjectAt: &dictionary withName: &name]; [archiver decodeObjectAt: &dictionary withName: &name];
if (name) if (name)
printf ("got object named %s\n", [name cStringNoCopy]); printf ("got object named %s\n", [name cString]);
else else
printf ("got object named (unnamed)\n"); printf ("got object named (unnamed)\n");

View file

@ -1,4 +1,6 @@
/* A demonstration of writing and reading with NSArchiver */ /* A demonstration of writing and reading with NSArchiver */
// Fri Oct 23 03:02:04 MET DST 1998 dave@turbocat.de
// cStringNoCopy -> cString
#if 1 #if 1
@ -30,7 +32,7 @@ int main()
{ {
id o, e = [set objectEnumerator]; id o, e = [set objectEnumerator];
while ((o = [e nextObject])) while ((o = [e nextObject]))
printf("%s\n", [o cStringNoCopy]); printf("%s\n", [o cString]);
} }
apl = [[NSAutoreleasePool alloc] init]; apl = [[NSAutoreleasePool alloc] init];
@ -68,7 +70,7 @@ printf("%u\n", [arc retainCount]);
{ {
id o, e = [set objectEnumerator]; id o, e = [set objectEnumerator];
while ((o = [e nextObject])) while ((o = [e nextObject]))
printf("%s\n", [o cStringNoCopy]); printf("%s\n", [o cString]);
} }
/* Do the autorelease. */ /* Do the autorelease. */

View file

@ -1,3 +1,6 @@
// Fri Oct 23 03:02:52 MET DST 1998 dave@turbocat.de
// cStringNoCopy -> cString
#include <Foundation/NSArray.h> #include <Foundation/NSArray.h>
#include <Foundation/NSString.h> #include <Foundation/NSString.h>
#include <Foundation/NSHost.h> #include <Foundation/NSHost.h>
@ -12,10 +15,10 @@ displayHost(NSHost* h)
printf("\n"); printf("\n");
a = [h names]; a = [h names];
for (i = 0; i < [a count]; i++) for (i = 0; i < [a count]; i++)
printf("%s\n", [[a objectAtIndex:i] cStringNoCopy]); printf("%s\n", [[a objectAtIndex:i] cString]);
a = [h addresses]; a = [h addresses];
for (i = 0; i < [a count]; i++) for (i = 0; i < [a count]; i++)
printf("%s\n", [[a objectAtIndex:i] cStringNoCopy]); printf("%s\n", [[a objectAtIndex:i] cString]);
} }
int int

View file

@ -1,5 +1,8 @@
#include <Foundation/NSString.h> #include <Foundation/NSString.h>
// Fri Oct 23 02:58:47 MET DST 1998 dave@turbocat.de
// cStringNoCopy -> cString
/* For demo of Strings as Collections of char's. */ /* For demo of Strings as Collections of char's. */
#include <Foundation/NSString.h> #include <Foundation/NSString.h>
#include <Foundation/NSAutoreleasePool.h> #include <Foundation/NSAutoreleasePool.h>
@ -7,7 +10,7 @@
void void
print_string(NSString* s) print_string(NSString* s)
{ {
printf("The string [%s], length %d\n", [s cStringNoCopy], [s length]); printf("The string [%s], length %d\n", [s cString], [s length]);
} }
#include <Foundation/NSString.h> #include <Foundation/NSString.h>