English
Source / code snippets

File Text comparison

 
Text File comparison procedure - Have I sometime time used ^^
procedure position only solid whether The Textfiles exakt same are. it go no differences gefiltert.

 {$iq}//xpse
cls
print "is exact same?: "+if(fle_compareexact ("org.txt","second.txt"),"Jo","Nö")
waitkey
end

proc fle_compareexact

    parameters fle1$,fle2$
    declare ex%,s$,ss$
    assign #1,fle1$
    assign #2,fle2$
    reset #1
    reset #2
    ex%=0

    whilenot ex%

        input #1,s$
        input #2,ss$

        if (trim$(s$)<>trim$(ss$))

            ex%:=2

        elseif ( eof(#1) & eof(#2) )

            ex%:=1

        elseif eof(#1)

            ex%:=2

        elseif eof(#2)

            ex%:=2

        endif

        case ( eof(#1) & eof(#2) ) : casenot ex% : ex%:=1

    wend

    close #1
    close #2
    return if(equ(ex%,1),1,0)

endproc

 
11/29/04  
 




Frank
Abbing
Hi,

here my Variante, with the arbitrary Files on equality examined go can. and the very quick.
Files on equality Verify
(c) Frank Abbing
Set("ErrorLevel",0)
Declare Text$
Def CompareStrings(2) !"KERNEL32","lstrcmpi"
Cls
text$=SameDatas("Dateiname_1","Dateiname_2")
Print "Die both Files are "+text $+"."
WaitInput
End
two Files vergleichen
SameDatas para1, para2
para1 = name of File 1
Para2 = name of File 2

Proc SameDatas

    Parameters gtext1$,gtext2$
    Declare gx&,gx1&,gx2&,gbereich1#,gbereich2#
    gx1&=FileSize(gtext1$)
    gx2&=FileSize(gtext2$)
    gx&=gx1&+gx2&

    If ((gx&>0) and (gx1&=gx2&))

        Dim gbereich1#,gx1&
        Assign #1,gtext1$
        OpenRW #1
        @BlockRead(#1,gbereich1#,0,gx1&)
        CloseRW #1
        Dim gbereich2#,gx2&
        Assign #1,gtext2$
        OpenRW #1
        @BlockRead(#1,gbereich2#,0,gx2&)
        CloseRW #1
        gx&=CompareStrings(gbereich1#,gbereich2#)
        Dispose gbereich1#
        Dispose gbereich2#

        If (gx&=0)

            Return "gleich"

        Else

            Return "ungleich"

        EndIf

        Return "gleich"

    Else

        Case (gx1&<>gx2&): Return "verschieden big and so ungleich"
        Return "nicht present or defective. at least a davon"

    EndIf

ENDPROC

 
11/29/04  
 




Rolf
Koch
Hi Frank
and by me functions your example not.

CROFANA.TXT and CROFANB.TXT laid out and same Content.
Return is: No or defective. at least a of it

But everything present and Order.

Rolf
 
11/29/04  
 




Frank
Abbing
Hi,

then could the program a of it Perhaps not loading?
Fehlt sure only one FileMode 0. could you the review with you?
 
11/30/04  
 




Rolf
Koch
Hello Frank,
No both fully aale. before freshly laid out. means integrally normal Files.
not read or so.

Rolf
 
11/30/04  
 



my Proc having a small logischen Error - with Dateiende wars alike whether The last both Lines übereinstimmten if both Files same-many Lines had.

Habs fixed.

@Frank: your Proc is less suitable TextFiles To vergleichen. Text files must not The same Size having circa same To his - too must tappt im dunkeln never byteexact-same his. How the name already says - the same Text must drinnstehen - even if on the right place.

naturally is ne while { input combination always ne SpeedKrücke - and naturally ließe the operation too as Speicheroperation manage. Bisl mempos on #10 etc.

salvo, iF
 
11/30/04  
 




Frank
Abbing
iF, space etc. belong likewise to that Text and its Formatierung. alike whether Textdatei or other, Übereinstimmung is by me exakte Übereinstimmung. but Please.
Rolf, What is there go. you are the Programmierens still More as capable. find You the trouble not? I can nothing discover...
 
11/30/04  
 




Rolf
Koch
Well, i'm To More capable, the likes his. however work I in retail and it short to christmas ...... must I there yet plenty say.
I Have z.Zt. by the Stress even Problems a fünfzeiler To write, without that I me dauernd verhaue
no, but it's located really nothing ungewöhnliches to.
both Text files whether equal to or abgeändert report whom Error.
both Text files are straight freshly prepares been.
both Text files are for read/Schreibzugriff fine suitable.
unfortunately How already from supra named Found and because of Noc Update (so I finally again with empty Roc weg can - soon comes Yes P9 and there should Roc too correct his) come I do not moreover your Sourcecode detailgenau durchzugehen. but I wealth, that your code still correctly arranged is, or?

Rolf
 
11/30/04  
 



Frank I know the space to that Text belong. I Have still too never what other behauptet - you are soo miserable. I wrote Text files must not The same Size and have neither byte-exact.

the can to that Bleistift hot the a Textdatei too then whom equal Textinhalt has if these z.B. with others Steuerzeichen stored is.

z.B. only #10 instead of #13#10

but what erzähl I you - sure nothing New.

the Trim what supra standing is objectively less correctly.. hang of it ex for what one The Proc benefit would like - möge eachone self decide. there geb I you right - but meant You, the?

salvo, iF
 
11/30/04  
 




Frank
Abbing
@iF: clear, habs Yes understood . should the User still decide, what the right for it is, ne?

@Rolf: Schick me the two Files still simply time. naturally only, if You want...
shining so, as would FileSize not correctly. works...

P.s. is christmas not the solid the silence and relaxation? :biggrin:
 
11/30/04  
 



[quote:db58989a3e=Frank Abbing]@iF: clear, habs Yes understood . should the User still decide, what the right for it is, ne? [/quote:db58989a3e]Nain grrrr the Programmer.

[quote:db58989a3e]@Rolf: Schick me the two Files still simply time. naturally only, if You want...
shining so, as would FileSize not correctly. works...

P.s. is christmas not the solid the silence and relaxation? :biggrin:[/quote:db58989a3e]I know not the we here what other do.

salvo, iF

 
11/30/04  
 




Jörg
Sellmeyer
Hi,
so How I that see, get the program quite no chance mismatched Files testing there
If ((gx&>0) and (gx1&=gx2&))
mismatched Files already ausschließt and same to Error Message verzweigt.
with Or ought to it functions.
Greeting
Jörg
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
12/01/04  
 




Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

16.501 Views

Untitledvor 0 min.
PETER195603/23/16
Hans Hermann03/18/13

Themeninformationen



Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie