blob: 12e08e9acc2d278ab2474f4144be4244f402f6ee [file] [log] [blame]
xians@webrtc.orge46bc772014-10-10 08:36:56 +00001/*
2 * Copyright 2014 The WebRTC Project Authors. All rights reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#ifndef WEBRTC_BASE_PLATFORM_FILE_H_
12#define WEBRTC_BASE_PLATFORM_FILE_H_
13
14#include <stdio.h>
15
16#if defined(WEBRTC_WIN)
17#include <windows.h>
18#endif
19
20namespace rtc {
21
22#if defined(WEBRTC_WIN)
23typedef HANDLE PlatformFile;
24#elif defined(WEBRTC_POSIX)
25typedef int PlatformFile;
26#else
27#error Unsupported platform
28#endif
29
30extern const PlatformFile kInvalidPlatformFileValue;
31
32// Associates a standard FILE stream with an existing PlatformFile.
33// Note that after this function has returned a valid FILE stream,
34// the PlatformFile should no longer be used.
35FILE* FdopenPlatformFileForWriting(PlatformFile file);
36
37// Closes a PlatformFile.
38// Don't use ClosePlatformFile to close a file opened with FdopenPlatformFile.
39// Use fclose instead.
40bool ClosePlatformFile(PlatformFile file);
41
42} // namespace rtc
43
44#endif // WEBRTC_BASE_PLATFORM_FILE_H_