---
name: "http_parseFilename"
section: "3"
platform: "linux"
package: "libhttpfetcher-dev"
version: "1.0.1-3"
release: "Debian 3.1 (Sarge)"
platforms: ["linux"]
url: "https://new.carta.tech/http_parseFilename"
---

# http\_parseFilename(3)

Takes a URL and parses out the filename from it.

## NAME

**http\_parseFilename** - Takes a URL and parses out the filename from it.

## SYNOPSIS

**#include \<http\_fetcher.h\>**\

**int http\_parseFilename(const char \****url***, char \*\****filename*);\

## DESCRIPTION

Takes a URL and determines the filename at the end of it.  If there is one, memory is allocated to hold the string and is pointed to by *filename*.

For example, in "http://www.foo.com/bar/fubar.html" the filename would be "fubar.html".

## RETURN VALUE

Returns 0 on success.

Returns 1 when there is no end filename, for instance "www.foo.com" or "www.bar.org/" in which case *filename* should NOT be assumed to be a valid pointer.

On error, -1 is returned, and **http\_perror** can be used to print an informative error message.  **http\_strerror** can be used to get a pointer to the current error description message.

## SEE ALSO

[**http\_fetch**(3)](/http_fetch/3.md), [**http\_setUserAgent**(3)](/http_setUserAgent/3.md), [**http\_setReferer**(3)](/http_setReferer/3.md), [**http\_setTimeout**(3)](/http_setTimeout/3.md), [**http\_perror**(3)](/http_perror/3.md), [**http\_strerror**(3)](/http_strerror/3.md)
