#include#include #include "seekable_read_stream.h" using namespace std; int main() { ifstream file("data.bin", ios::binary); SeekableReadStream stream(file); uint32_t value = stream.readUint32BE(); cout << value << endl; return 0; }
#includeThis code sends a HTTP request to a server, receives the response and reads a 32-bit unsigned integer from it using the SeekableReadStream class.#include #include "seekable_read_stream.h" using namespace std; int main() { // Connect to a server Socket socket("example.com", 12345); // Send a request socket.send("GET / HTTP/1.1\r\n\r\n"); // Receive response char buffer[4096]; int nbytes = socket.recv(buffer, sizeof(buffer)); SeekableReadStream stream(buffer, nbytes); uint32_t value = stream.readUint32BE(); cout << value << endl; return 0; }