CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
hrydgard

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: hrydgard/ppsspp
Path: blob/master/Common/File/FileDescriptor.h
Views: 1401
1
#pragma once
2
3
#include <cstring>
4
#include <string>
5
6
namespace fd_util {
7
8
// Slow as hell and should only be used for prototyping.
9
size_t ReadLine(int fd, char *buffer, size_t buf_size);
10
11
// Decently fast.
12
size_t WriteLine(int fd, const char *buffer, size_t buf_size);
13
size_t WriteLine(int fd, const char *buffer);
14
size_t Write(int fd, const std::string &str);
15
16
// Returns true if the fd became ready, false if it didn't or
17
// if there was another error.
18
bool WaitUntilReady(int fd, double timeout, bool for_write = false);
19
20
void SetNonBlocking(int fd, bool non_blocking);
21
22
std::string GetLocalIP(int sock);
23
24
} // fd_util
25
26