Q:

a C-program using some posix commands

error: request for member `st_mode' in something not a structure or union
error: syntax error before ')' token
error: incompatible type for argument 1 of `read'
/* Here is the code */

int main( int argc, char **argv)

{

    int src, dst;
    char buf[BUFSIZE];
    int n;

    if (argc!=3)
    {
      printf("\n usage: copy src dst\n");
      return -1;
    }

  struct stat src;

  if(stat(argv[1],&src) < 0)

  return 1;

  printf("File Permissions for source file: \t");

  printf("%d", S_ISDIR(src.st_mode)) ? "d" : "-");

  printf(src.st_mode & S_IRUSR) ? "r" : "-");

  printf(src.st_mode & S_IWUSR) ? "w" : "-");

  printf(src.st_mode & S_IXUSR) ? "x" : "-");

  int creat(char *dst,int perms);

  printf("File Permissions for destination file: \t");

  printf(S_ISDIR(src.st_mode)) ? "d" : "-");

  printf(dst.st_mode & S_IRUSR) ? "r" : "-");

  printf(dst.st_mode & S_IWUSR) ? "w" : "-");

  printf(dst.st_mode & S_IXUSR) ? "x" : "-");

  src=open(argv[1], O_RDONLY | S_IRUSR | S_IWUSR |S_IXUSR | );

  dst=open(argv[2], O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR |S_IXUSR);

  while ((n=read(src, buf, BUFSIZE)) > 0)

  {

    if (write(dst, buf, n) != n)

    printf("write error!");

  }

   if (n<0){

   printf("read error !");

  }

   close(src);

   close(dst);

   exit(0);

}

A:

Your approach to writing code is wrong, there's a huge list of syntax errors in what you have posted (unless that's a copy/paste effect). You wrote a bunch of lines and then try to compile them. That won't work. In your learning phase you should try to compile your code every 2 lines and try to run it every 4 lines (really).
To summarize:

most of your ternary operators ... ? ... : ... have mismatching parentheses
you call the "." operator on an int (dst). "dot" is only available on struct types.
your identation is all out of place, try to improve it
There's a function declaration in the body of another function, it should be before the function using it.

