相关疑难解决方法(0)

我如何从内存中读取,就像使用iostream的文件一样?

我有简单的文本文件加载到内存中.我想从内存中读取,就像我从像这里的光盘中读到的那样:

ifstream file;
string line;

file.open("C:\\file.txt");
if(file.is_open())
{
    while(file.good())
    {
        getline(file,line);         
    }
}   
file.close();
Run Code Online (Sandbox Code Playgroud)

但我有记忆中的档案.我在内存中有一个地址和这个文件的大小.

我必须做些什么才能获得与上述代码中处理文件相同的流畅度?

c++ memory iostream

7
推荐指数
4
解决办法
7768
查看次数

读取 dll 文件中的文本文件

设置

Microsoft Visual Studio Professional 2015,在Windows 10 Pro
Unity 5.3.1f1 (x64) 上运行
该项目基于 Unity 在其网站上提供的示例项目该项目可以在这里找到


需要做的事

我正在研究创建一个用于 Unity 的 opengl 插件(以 dll 的形式)。在他们的示例代码中,顶点片段着色器在代码中被硬编码,如下所示:

#define VPROG_SRC(ver, attr, varying)                               \
    ver                                                             \
    attr " highp vec3 pos;\n"                                       \
    attr " lowp vec4 color;\n"                                      \
    "\n"                                                            \
    varying " lowp vec4 ocolor;\n"                                  \
    "\n"                                                            \
    "uniform highp mat4 worldMatrix;\n"                             \
    "uniform highp mat4 projMatrix;\n"                              \
    "\n"                                                            \
    "void main()\n"                                                 \ …
Run Code Online (Sandbox Code Playgroud)

c++ dll shader unity-game-engine

5
推荐指数
1
解决办法
2099
查看次数

标签 统计

c++ ×2

dll ×1

iostream ×1

memory ×1

shader ×1

unity-game-engine ×1