.\" Automatically generated by Pandoc 3.1.11.1 .\" .TH "al_android_open_fd" "3" "" "Allegro reference manual" "" .SH NAME al_android_open_fd \- Allegro 5 API .SH SYNOPSIS .IP .EX #include int al_android_open_fd(const char *uri, const char *mode) .EE .SH DESCRIPTION Opens a file descriptor to access data under a Universal Resource Identifier (URI). This function accepts content:// and file:// URI schemes. You are responsible for closing the returned file descriptor. .PP The file \f[CR]mode\f[R] can be \f[CR]\[dq]r\[dq]\f[R], \f[CR]\[dq]w\[dq]\f[R], \f[CR]\[dq]rw\[dq]\f[R], \f[CR]\[dq]wt\[dq]\f[R], \f[CR]\[dq]wa\[dq]\f[R] or \f[CR]\[dq]rwt\[dq]\f[R]. The exact implementation of these modes differ depending on the underlying content provider. For example, \f[CR]\[dq]w\[dq]\f[R] may or may not truncate. .PP Returns a file descriptor on success or a negative value on an error. On an error, the Allegro errno is set. .RS .PP \f[I]Note:\f[R] Remember to add to your manifest file the relevant permissions to your app. .RE .PP Example: .IP .EX const char *content_uri = \[dq]content://...\[dq]; int fd = al_android_open_fd(content_uri, \[dq]r\[dq]); if (fd >= 0) { ALLEGRO_FILE *f = al_fopen_fd(fd, \[dq]r\[dq]); if (f != NULL) { do_something_with(f); al_fclose(f); } else { handle_error(al_get_errno()); close(fd); } } else { handle_error(al_get_errno()); } .EE .SH SINCE 5.2.10 .SH SEE ALSO al_fopen_fd(3), al_get_errno(3) .RS .PP \f[I][Unstable API]:\f[R] This API is new and subject to refinement. .RE