Skip to content
⌘ NSIS Forum Archive

Text file manipulation without temp file

2 posts

Instructor#

Text file manipulation without temp file

How can I, for exapmle, delete line in text file without using temp file (WriteINIStr not use temp file)? Which API calls can be used?
Instructor#
Founded. Thanks if somebody tried to help.

Delete range from 10 to 20:
	FileOpen $0 "C:\File.txt" a
FileSeek $0 0 END $1
IntOp $2 $1 - 20
System::Alloc $2
Pop $3

FileSeek $0 20 SET
System::Call 'kernel32::ReadFile(i r0, i r3, i $2, t.,)'
FileSeek $0 10 SET
System::Call 'kernel32::WriteFile(i r0, i r3, i $2, t.,)'
System::Call 'kernel32::SetEndOfFile(i r0)'

System::Free $3
FileClose $0