mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 00:11:26 +00:00
Patches submitted from May 20 to Aug 28 1997
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@2406 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
7b12c4af23
commit
a57d791f91
119 changed files with 16409 additions and 1698 deletions
47
Testing/nsfilehandle.m
Normal file
47
Testing/nsfilehandle.m
Normal file
|
@ -0,0 +1,47 @@
|
|||
#include <Foundation/NSAutoreleasePool.h>
|
||||
#include <Foundation/NSFileHandle.h>
|
||||
#include <Foundation/NSData.h>
|
||||
#include <Foundation/NSString.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
id pool;
|
||||
id src;
|
||||
id dst;
|
||||
id d0;
|
||||
id d1;
|
||||
|
||||
pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
src = [[NSFileHandle fileHandleForReadingAtPath:@"nsfilehandle.m"] retain];
|
||||
assert(src != nil);
|
||||
dst = [[NSFileHandle fileHandleForWritingAtPath:@"nsfilehandle.dat"] retain];
|
||||
if (dst == nil)
|
||||
{
|
||||
creat("nsfilehandle.dat", 0644);
|
||||
dst = [[NSFileHandle fileHandleForWritingAtPath:@"nsfilehandle.dat"] retain];
|
||||
}
|
||||
assert(dst != nil);
|
||||
|
||||
d0 = [[src readDataToEndOfFile] retain];
|
||||
[dst writeData:d0];
|
||||
[src release];
|
||||
[dst release];
|
||||
[pool release];
|
||||
|
||||
pool = [[NSAutoreleasePool alloc] init];
|
||||
src = [[NSFileHandle fileHandleForReadingAtPath:@"nsfilehandle.dat"] retain];
|
||||
d1 = [[src readDataToEndOfFile] retain];
|
||||
[src release];
|
||||
[pool release];
|
||||
|
||||
unlink("nsfilehandle.dat");
|
||||
|
||||
if ([d0 isEqual:d1])
|
||||
printf("Test passed (length:%d)\n", [d1 length]);
|
||||
else
|
||||
printf("Test failed\n");
|
||||
|
||||
exit (0);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue