digitalmars.D.learn - Read a text file in any position.
- Giovanni Di Maria (22/22) Jan 18 2019 Hi All
- bauss (6/28) Jan 18 2019 Use File (https://dlang.org/library/std/stdio/file.html)
- Giovanni Di Maria (3/37) Jan 18 2019 Thank you very very much.
Hi All I have a text file like this: 111111 222222 333333 444444 555555 666666 777777 ...... I execute these functions: i = archive.readln(); i = archive.readln(); i = archive.readln(); i = archive.readln(); so "i" is 444444. Is there a method to move the pointer of file to beginning of file or to any position (for example back to 2nd row), without to close the file? Thank you very much. Regards Giovanni
Jan 18 2019
On Friday, 18 January 2019 at 08:10:25 UTC, Giovanni Di Maria wrote:Hi All I have a text file like this: 111111 222222 333333 444444 555555 666666 777777 ...... I execute these functions: i = archive.readln(); i = archive.readln(); i = archive.readln(); i = archive.readln(); so "i" is 444444. Is there a method to move the pointer of file to beginning of file or to any position (for example back to 2nd row), without to close the file? Thank you very much. Regards GiovanniUse File (https://dlang.org/library/std/stdio/file.html) And seek() (https://dlang.org/library/std/stdio/file.seek.html) And then one of its read functions. rawRead will let you read the raw bytes at the position.
Jan 18 2019
On Friday, 18 January 2019 at 08:49:08 UTC, bauss wrote:On Friday, 18 January 2019 at 08:10:25 UTC, Giovanni Di Maria wrote:Thank you very very much. GiovanniHi All I have a text file like this: 111111 222222 333333 444444 555555 666666 777777 ...... I execute these functions: i = archive.readln(); i = archive.readln(); i = archive.readln(); i = archive.readln(); so "i" is 444444. Is there a method to move the pointer of file to beginning of file or to any position (for example back to 2nd row), without to close the file? Thank you very much. Regards GiovanniUse File (https://dlang.org/library/std/stdio/file.html) And seek() (https://dlang.org/library/std/stdio/file.seek.html) And then one of its read functions. rawRead will let you read the raw bytes at the position.
Jan 18 2019