EADST

C++: Load Raw Data and Convert to Float Pointer

C++: Load Raw Data and Convert to Float Pointer

 #include  < fstream>
#include  < iostream>

using namespace std;


int main() {
    string file_path = "./test.raw";
    ifstream fin;
    fin.open(file_path,  std::ios::binary);
    if (!fin) {
        cerr << "open failed: " << file_path << endl;
        return -1;
    }
    fin.seekg(0, fin.end);
    int length = fin.tellg();
    fin.seekg(0, fin.beg);
    char* buffer = new char[length];
    fin.read(buffer, length);
    // convert to float pointer
    float *tmp = (float *)buffer;
    for(int idx = 0;idx < 100;idx++)
    {   
        cout << tmp[idx] << endl;
    }
    return 0;
}
相关标签
C++
About Me
XD
Goals determine what you are going to be.
Category
标签云
Jetson HuggingFace API TensorFlow QWEN 关于博主 Dataset COCO printf Pandas VGG-16 IndexTTS2 Gemma Statistics YOLO 域名 Bert Algorithm Random Markdown Diagram PyCharm TSV Safetensors HaggingFace Image2Text Django Bitcoin 多进程 PDF 搞笑 报税 torchinfo Heatmap Tiktoken icon Qwen2 Qwen2.5 BeautifulSoup 强化学习 Shortcut v0.dev Base64 InvalidArgumentError CSV CV Domain tqdm OpenCV PIP Land NameSilo Plotly SQL ChatGPT scipy FP64 Excel Paddle NLP transformers GoogLeNet WAN Datetime Numpy Web Permission Transformers FastAPI mmap Breakpoint ResNet-50 Review Nginx Vim Video Password Math GGML Input LoRA 论文速读 logger 算法题 Anaconda Quantization VPN CEIR Card Data 论文 Bin 云服务器 CC diffusers Hilton Mixtral Food CUDA FlashAttention Firewall Claude uWSGI Freesound GPTQ 继承 DeepStream PyTorch Hotel News ONNX 签证 Pillow Baidu Tracking Docker UI 证件照 Translation 飞书 OpenAI git-lfs 净利润 LLAMA AI Paper JSON Interview ModelScope LaTeX Rebuttal Search Python CLAP Proxy VSCode RGB SVR BF16 Agent 第一性原理 Clash RAR Linux LLM Website PDB Sklearn Augmentation XGBoost Plate Pickle MD5 Michelin Llama 音频 FP32 git uwsgi hf Attention Github Qwen Crawler BTC Ptyhon Bipartite GIT WebCrawler Windows 公式 Vmess Cloudreve Streamlit 图标 Disk Miniforge DeepSeek 图形思考法 腾讯云 v2ray TensorRT Pytorch Logo FP16 XML SPIE FP8 Conda TTS SAM Ubuntu Hungarian Distillation UNIX GPT4 多线程 Quantize Knowledge Color Magnet Use Jupyter 阿里云 CAM llama.cpp NLTK Zip Template Tensor Animate EXCEL C++ 顶会 OCR 财报 Git CTC 递归学习法 版权 LeetCode Google SQLite tar
站点统计

本站现有博文327篇,共被浏览833405

本站已经建立2538天!

热门文章
文章归档
回到顶部