jwurmz Posted January 13, 2010 Share Posted January 13, 2010 (edited) I'm opening a file (w/ flag 16), reading the contents of a file as binary string, converting the binary string (with BinaryToString) to a 'regular' string, and trying to StringReplace a potion of it based on a start value (portion length = replacement string length, start value = predetermined offset in the file). The problem is StringReplace is returning 1 (along with 'eating' my source string) and I'm not exactly sure why. Some of the characters in the converted 'regular string' are sometimes unprintable characters; they may be any value 0-255. I guess my question is -- does StringReplace return error = 1 if it encounters any unprintable characters in the source string? Edited January 13, 2010 by jwurmz Link to comment Share on other sites More sharing options...
jchd Posted January 13, 2010 Share Posted January 13, 2010 Can you show a simplified code failing to work as you expect, along if possible with an example of the contents of the offending file? This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
jwurmz Posted January 13, 2010 Author Share Posted January 13, 2010 Actually, I found a workaround by using a couple extra StringMid steps instead -- works exactly as I expect it to now. Thank youA lot of functions choke on Null characters. It would be easier to just work with the binary.I tried working with it in binary form and all of the sudden other areas of my program started acting funny.Can you show a simplified code failing to work as you expect, along if possible with an example of the contents of the offending file?If you're still wanting to look at it for the sake of curiosity, I can supply the data files and the source but the logic for StringReplace has been completely removed from my code so you would have to build that part back in yourself. The problem has been sidestepped, so it's up to you.Thanks for all your help over the last week jchd, it's very much appreciated! Link to comment Share on other sites More sharing options...
jchd Posted January 13, 2010 Share Posted January 13, 2010 Thanks for all your help over the last week jchd, it's very much appreciated!You're welcome! This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now