Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

delete a string in a file in x86

Status
Not open for further replies.

Tozilla

Programmer
Mar 28, 2003
3
0
0
AU
can anyone show me some examples how to delete a string?I only can delete a single characters
 
How do you mean "delete a string"? Do you mean, set a whole series of bytes to zero?
If so, you can either write your own loop, which is easy, or you can look into using the string opcodes like movs, which combine nicely with a rep prefix, which will do the loop counting for you.
There are two sorts of string you might be thinking of: ones of a predefined length, and ones that simply end with an end-character such as zero. The latter are less easy to handle, especially by rep movs. It would probably be easiest in a loop like that to test each byte of the string to see if it is the terminator. This will set the flags. Then mov a zero into that byte of the string (which won't change the flags!!), and then jump if not terminator back to the instruction where you read (remembering of course to increment to the next character!).

I hope you don't mean "delete a string" in the higher-level language sense of free up the memory that has been allocated to that string.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top