简体   繁体   English

Erlang:如何获取当前文件的光标位置

[英]Erlang: How to get current file cursor position

In Erlang, the file module allows one to move the file cursor to a given position by file:position/2 . 在Erlang中, file模块允许通过file:position/2将文件光标移动到给定位置。 But after performing an operation such as file:read_line/1 , the cursor now moves. 但是在执行诸如file:read_line/1类的操作之后,光标现在会移动。

Is there any way to get its current location? 有什么方法可以获取其当前位置?

Sorry if this seems silly, I'm new to Erlang and I cannot seem to find any relevant function in the module documentation to perform this. 抱歉,这似乎很愚蠢,我是Erlang的新手,我似乎无法在模块文档中找到任何相关功能来执行此操作。 Any help will be much appreciated. 任何帮助都感激不尽。

要获取当前文件位置,请使用原子cur作为第二个参数调用file:position/2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM