Logo Search packages:      
Sourcecode: libgphoto2 version File versions

int gp_file_new_from_fd ( CameraFile **  file,
int  fd 
)

Create new CameraFile object from a UNIX filedescriptor.

Parameters:
file a pointer to a CameraFile
fd a UNIX filedescriptor
Returns:
a gphoto2 error code.

Definition at line 107 of file gphoto2-file.c.

References CHECK_NULL, GP_ERROR_NO_MEMORY, GP_FILE_ACCESSTYPE_FD, GP_FILE_TYPE_NORMAL, and GP_OK.

{
      CHECK_NULL (file);

      *file = malloc (sizeof (CameraFile));
      if (!*file)
            return (GP_ERROR_NO_MEMORY);
      memset (*file, 0, sizeof (CameraFile));

      (*file)->type = GP_FILE_TYPE_NORMAL;
      strcpy ((*file)->mime_type, "unknown/unknown");
      (*file)->ref_count = 1;
      (*file)->accesstype = GP_FILE_ACCESSTYPE_FD;
      (*file)->fd = fd;
      return (GP_OK);
}


Generated by  Doxygen 1.6.0   Back to index