stream file 文件 数据流
- c - Do stdio file descriptors (stdin, stdout, stderr) get opened, simply from #include'ing <stdio.h>? - Stack Overflow
- standard streams of a program are opened by the operating system? or, inherit from its parent (, which inherit from its ancestor who opens these standard streams).
- initialization - execute
- initialization: loading symbol tables, assigning memory, initializing static data, linking dynamic libraries, open standard streams.
- execute: main() function
- fork() - exec():
- fork(): to create a new process, which is still running under shell code.
- exec(): to yield control from shell code to user code.
- (standard) file descriptors 0, 1, and 2 (or more customer ones)
- file - What does 'stream' mean in C? - Stack Overflow
- file & stream.
- 文件-静态,流-(input/流入、output/流出间可)异步动态。
- pipe / tube / flow. cache / buffer / pool/池。
- 具象的files, sockets, device (keyboards, USB ports, printers),抽象为接口/interface,logical entity,称为数据流/data stream 。
- 此抽象亦叫做文件句柄——pointer to the stream.
- cout 是C++中的output stream的对象(封装)形式。
- Standard streams - Wikipedia
In computer programming, standard streams are interconnected input and output communication channels[1] between a computer program and its environment when it begins execution. The three input/output (I/O) connections are called standard input (stdin), standard output (stdout) and standard error (stderr). Originally I/O happened via a physically connected system console (input via keyboard, output via monitor), but standard streams abstract this. When a command is executed via an interactive shell, the streams are typically connected to the text terminal on which the shell is running, but can be changed with redirection or a pipeline. More generally, a child process inherits the standard streams of its parent process.
-
- 结论,效果无益
- FileStream / MemoryStream.
- disk accesses / paging
- FileStream constructor
- Temp directory: something like C:\Users\UserName\AppData\Local\Temp\ , from environment variable TMP - TEMP -USERPROFILE - ..
- python - How to do virtual file processing? - Stack Overflow
tempfile.SpooledTemporaryFile(python)
- StringIO , BytesIO(python)
- File system - Wikipedia
- Console Handles - Windows Console | Microsoft Docs
A console process (not all process) uses (standard) handles.
-
- process associate with console.
- console有input buffer, output (screen) buffer (console output)。可以通过 CreateFile +CONIN$ /CONOUT$获取。
- console proccess有STDIN, STDOUT等。默认继承自父。可以通过 SetStdHandle 改变。
-
- GetStdHandle , CreateFile , CreateConsoleScreenBuffer
The standard handles associated with a process.
During console creation, the system creates these handles.
The parent's standard handles are inherited by any child process
The value of the handles returned by GetStdHandle are not 0, 1, and 2, so the standard predefined stream constants in Stdio.h ( STDIN , STDOUT , and STDERR ) cannot be used in functions that require a console handle.
-
- std handle initial associate to console buffer.
- SetStdHandle redirect/重定向
- CreateFile +CONIN$ /CONOUT$ (CON: Console, Create: Retrieve the exist)
- CreateConsoleScreenBuffer - SetConsoleActiveScreenBuffer
GetFileTypecan assist in determining what device type the handle refers to
-
- DuplicateHandle - AttachConsole
- 开发GUI程序时同时打开一个控制台窗口进行调试多么惬意啊 - MudooT - 博客园
- 为非Console进程建立Console进程并关联。
- 使用AllocConsole() 建立Console,使用open+conin$/conout$获取Console中的输入/输出句柄,进而可以进行输入/输出访问操作(关联)。
- open - close(句柄);alloc - free(Console)。
- 以上我新建Console,除此,可以使用AttachConsole附加到已有。
- GetStdHandle function - Windows Console | Microsoft Docs
standard device (standard input, standard output, or standard error).
-
- an application (such as running on an interactive desktop) may not have associated standard handles.
- ReadConsoleInput , WriteConsole , GetConsoleScreenBufferInfo ; CreateFile + CONIN$ /CONOUT$ 。
- GUI(graphical user interface)可使用 AttachConsole , AllocConsole , FreeConsole 建立console交互。
- 使用 GetFileType 检查继承到的标准输入输出/STDIO。
- LuaFileSystem
- lfs.lock lfs.unlock
- 随想:
- 一个字符串也算一个对象、数据流。
- 元数据/属性为(主)数据基于描述系统(如文件系统)的,相对于主数据的附属数据。
- 考虑:
- (基于内存的)虚拟文件对象/流;->效果无益
- 公共文件对象/流;->见下
- Lua中的io.tmpfile() 。
- 搜索:
A console process uses handles
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?