compare two strings in two files

4 posts / 0 new
Last post
Nube
Nube's picture
Offline
Last seen: 5 years 7 months ago
Joined: 2012-09-10 02:09
compare two strings in two files

I can read the content of a file using the FRead Function of AmigaDOS. I can use two while cycle to read two file at the same time, but what I would like to do is to compare the content of these two files..

i was looking through sdk and I saw two functions: ParsePatternNoCase() and MatchPatternNoCase(). Have I to use both functions to compare the content of two files?

First ParsePatternNoCase and then MatchPatternNoCase? is it right?

hypex
hypex's picture
Offline
Last seen: 4 months 3 weeks ago
Joined: 2011-09-09 16:20
Re: compare two strings in two files

@Nube.

No, not exactly. Those functions are for doing pattern matching. If you were searching for a particular pattern such as #?Amiga#? then you'd run it through those functions to get a match.

Utility.library has Stricmp() amd Strnicmp() for case insensitive string comparison.

But you could just as easily use the C library functions.

Nube
Nube's picture
Offline
Last seen: 5 years 7 months ago
Joined: 2012-09-10 02:09
Re: compare two strings in two files

thanks for the information, I don't know much about amigaos (developer side) and I ignored utility library at all.. Thanks!

salass00
salass00's picture
Offline
Last seen: 7 months 1 week ago
Joined: 2011-02-03 11:27
Re: compare two strings in two files

I can read the content of a file using the FRead Function of AmigaDOS. I can use two while cycle to read two file at the same time, but what I would like to do is to compare the content of these two files..

If the intention is just to compare the two files to see if they are byte for byte identical. Then the simplest way to achieve this would be using the memcmp() function.

It returns zero if the compared buffers are identical and non-zero otherwise.

Log in or register to post comments