source: abuse/tags/pd/abuse/net/tdrv.c @ 49

Last change on this file since 49 was 49, checked in by Sam Hocevar, 11 years ago
  • Imported original public domain release, for future reference.
  • Property svn:keywords set to Id
File size: 554 bytes
Line 
1#include "../src/unixnfc.c"
2
3main(int argc, char **argv)
4{
5  if (net_init(argc,argv))
6  {
7
8    printf("try open %s\n",argv[1]);
9    int fd=NF_open_file(argv[1],"rb");   
10    printf("open returned %d\n",fd);
11    if (fd>0)
12    {
13      long size=NF_filelength(fd);
14      printf("sizeof file is %d\n",size);
15
16
17//      printf("seek returned %d\n",NF_seek(fd,2));
18
19      char *buffer=(char *)malloc(size);
20      long tr=NF_read(fd,buffer,size);
21     
22
23      printf("read %d bytes = \n",tr);
24      fwrite(buffer,size,1,stderr);
25    }
26
27    kill_net();
28  }
29}
30
31
Note: See TracBrowser for help on using the repository browser.