Results 1 to 5 of 5

Thread: C on Cygwin using Gcc stat function {Resolved}

Threaded View

  1. #1

    Thread Starter
    Addicted Member señorbadger's Avatar
    Join Date
    Oct 2003
    Location
    Mud pools of wellingborough
    Posts
    193

    Resolved C on Cygwin using Gcc stat function {Resolved}

    hello, excuse this work since im not that familiar with C but my university assignment says i must use it for this application.

    I have to make a application to copy files with confirm overwrites i seem to have hit an issue

    Im compiling this code using the Cygwin VM running on Windows XP compiling with GCC. can anyone see what is wrong with this code ?

    Code:
    #include <stdio.h>
    #include <sys/stat.h>
    #include <stdlib.h>
    #include <string.h>
    
    struct stat src_info;
    struct stat dest_info;
    
    int main(int argc, char **argv[])
    {
      //make sure we have a valid number of arguments
      if (argc == 3)
      {
         printf("Source: %s\nDestination: %s\n", argv[1], argv[2]);
         if (_stat(argv[1], &src_info)  == -1) { printf("Error with source could not get i-node\n"); exit(0); }
         if (_stat(*argv[2], &dest_info) == -1) { printf("Error with destination could not get i-node\n"); exit(0); }
      }
    }
    i compile in Cygwin using...

    $ gcc -o bin/safecp safecp.c
    safecp.c: In function `main':
    safecp.c:15: warning: passing arg 1 of `_stat' from incompatible pointer type

    thank you for your help sam
    Last edited by señorbadger; Nov 11th, 2005 at 02:50 PM. Reason: {Resolved}

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width