~ubuntu-branches/ubuntu/trusty/gnustep-base/trusty

« back to all changes in this revision

Viewing changes to Testing/nsfilehandle.m

Tags: upstream-1.11.2
ImportĀ upstreamĀ versionĀ 1.11.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Test/example program for the base library
 
2
 
 
3
   Copyright (C) 2005 Free Software Foundation, Inc.
 
4
   
 
5
  Copying and distribution of this file, with or without modification,
 
6
  are permitted in any medium without royalty provided the copyright
 
7
  notice and this notice are preserved.
 
8
 
 
9
   This file is part of the GNUstep Base Library.
 
10
*/
1
11
#include <Foundation/NSAutoreleasePool.h>
2
12
#include <Foundation/NSFileHandle.h>
 
13
#include <Foundation/NSFileManager.h>
3
14
#include <Foundation/NSData.h>
4
15
#include <Foundation/NSString.h>
 
16
#include <Foundation/NSURL.h>
5
17
#include <assert.h>
6
18
 
7
19
int
26
38
  assert(dst != nil);
27
39
 
28
40
  d0 = [[src readDataToEndOfFile] retain];
29
 
  [dst writeData:d0];
 
41
  [(NSFileHandle*)dst writeData: d0];
30
42
  [src release];
31
43
  [dst release];
32
44
  [pool release];
44
56
  else
45
57
    printf("Test failed\n");
46
58
 
 
59
  pool = [[NSAutoreleasePool alloc] init];
 
60
  src = [NSURL URLWithString: @"http://www.w3.org/index.html"];
 
61
  d0 = [src resourceDataUsingCache: NO];
 
62
  NSLog(@"Data is %@", d0);
 
63
  [pool release];
 
64
  
47
65
  exit (0);
48
66
}