ppsspp/Common/File/FileDescriptor.h

25 lines
622 B
C
Raw Normal View History

2020-09-29 08:24:41 +00:00
#pragma once
2020-09-29 08:24:41 +00:00
#include <cstring>
#include <string>
namespace fd_util {
// Slow as hell and should only be used for prototyping.
2020-09-29 08:24:41 +00:00
size_t ReadLine(int fd, char *buffer, size_t buf_size);
// Decently fast.
2020-09-29 08:24:41 +00:00
size_t WriteLine(int fd, const char *buffer, size_t buf_size);
size_t WriteLine(int fd, const char *buffer);
size_t Write(int fd, const std::string &str);
// Returns true if the fd became ready, false if it didn't or
// if there was another error.
2016-05-26 01:53:59 +00:00
bool WaitUntilReady(int fd, double timeout, bool for_write = false);
void SetNonBlocking(int fd, bool non_blocking);
std::string GetLocalIP(int sock);
} // fd_util