PDA

View Full Version : final project


ikhayriyyah
12-16-2003, 03:34 AM
k

ikhayriyyah
12-16-2003, 03:42 AM
sorry i just read that i'm not supposed to post these kind of thing...but i can ask a specific question...so here goes...in assembly language i'm not sure how to search through bits in a file to find a specific word...sorry if that doesn't make any sense i'm not sure how to word it...sorry again about my previous post...thanks

stuka
12-16-2003, 02:33 PM
OK, a few questions - x86 assembly, or something else? What platform (DOS/Windows, Linux, Mac)? Oh, and when you say 'a specific word', do you mean an English word, or a 16/32 bit word?

ikhayriyyah
12-17-2003, 05:31 AM
yes on the x86 assembler, NASM syntax to be more specific...on the Windows/DOS platform...and yes an english word...say i'm reading a binary file and looking for say the word "Dog" i then have to return the number associated with it...my question is how do i search through this binary file to find "Dog".

Ninja40
12-29-2003, 04:37 AM
The fastest searching algorithm is the Knuth-Morris-Pratt algorithm.
It must be an interesting challenge to wite it in asm, though.

stuka
12-29-2003, 11:27 AM
A simple, but inefficient, method would be like so:
1) open the file
2) start reading n-byte chunks of the file, where n is the length of the word you're looking for. (Note that you may need to do rewinds on the file pointer or some such, since you want to read n characters starting with EACH byte in the file, not every nth byte).
3) use a string comparison method (which should be trivial to write) to compare the chunk with your test word.