Cpp Get All Bytes Of A File


#include <fstream>
#include <memory>


int main() {
    std::ifstream infile("wow.text");

    //get length of file
    infile.seekg(0, infile.end);
    size_t length = infile.tellg();
    infile.seekg(0, infile.beg);

    //read file
    std::shared_ptr<uint8_t> buffer(new uint8_t[length], [](uint8_t* p){ delete [] p; });
    infile.read(buffer.get(), length);
}

2022

Back to Top ↑

2021

Back to Top ↑

2020

이론없이 컴파일러 만들기 꿈파일러 1

2 minute read

어릴 적 이야기 및 제작동기 어릴 적 이야기. 나는 학교에서 한 반에 있을 법한 컴퓨터를 매우 좋아하는 아이였다. 뭐 누구나 그렇겠지만 좋아하면 더 하고 싶고, 더 공부하고 싶고 그런다. 흘러 흘러 프로그래밍을 배우게 되었고 중3 겨울방학 Win32 API 에 빠져있던 무렵, 나에...

Back to Top ↑

2019

Reading C Pointer

12 minute read

``` #1905 손현곤 (sonsea ) [강좌] C 포인터 선언 이해의 새장 (소개) 01/04 12:53 25 line

Beast Websocket Client Async

2 minute read

beast library Beast is one of the c++ network library types. beast library belongs to boost libraries(Everyone knows boost).

Boost Asio Tutorial 강좌1

5 minute read

asio tutorial1 대상 C++ 의 기본적인 문법을 이해하는데 무리가 없고 STL 에 어느정도 거부감이 없는 사람

Back to Top ↑

2018

Vim Script

15 minute read

Vim Script 를 배워봅시다.== 이 페이지는 vim 사용법을 알려주는 페이지는 아니다. 좀 더 vim 고급 사용자로 가기 위해서 vim-script 를 배우는 페이지다.

Mix Boost Std

less than 1 minute read

https://meetingcpp.com/blog/items/c11-and-boost.html

Beast

4 minute read

```cpp // // Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com) // // Distributed under the Boost Software License, Version 1.0. (See a...

Back to Top ↑