News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

I need a program called "FindLine"

Started by learn64bit, November 29, 2022, 04:41:33 AM

Previous topic - Next topic

HSE

Quote from: learn64bit on November 29, 2022, 05:10:05 PM
a.txt and b.txt have 00h byte, 0D byte, and FFh byte... etc.., if that is ok, it is text file
the biggest line is under 4mb

Then it's not a text file, but a binary.  :biggrin:
Equations in Assembly: SmplMath

zedd151

If the two input files as well as the output file are indeed text files, what program are you using to open them? I am at a loss as to why a text file would contain 0h or 0FFh bytes. What would the usage for the file be? Obviously we don't understand this rather unorthodox use or formatting of text files, if thats what they are. How are they encoded (Ascii, utf-8, utf-16, UNICODE or ??), and what format (.txt, .rtf, some custom format?) ??


And by "FindLIne" do you mean finding a line by line number? Or find a line containing certain known text? Or find a line that meets some other criteria?
Can you post an example here, that is small enough to attach as a zip file in your post? (Not the 1 GB file that you mentioned earlier  :tongue: )

learn64bit

yes... maybe I should call them byte corrupted text file.

now... I want to start to build it. (sorry if I did not answer your questions)
first give the "AllocateUserPhysicalPages" a try, why this one? because I didn't found any masm32 source code use it.
I found a ms c/c++ example which use this API, of course our "FindLine" will be masm32 source code

[no Win11sdk, no VS2k23; I still use ms PlatformSDK for Win2k3 R2 and ms VS.NET 2k3]

TimoVJL

This might be useful
https://learn.microsoft.com/en-us/windows/win32/memory/file-mapping
May the source be with you

hutch--

It sounds like you want to perform binary search of byte patterns where you would need a starting and ending byte. This can be done reasonably easily as long as this is what you are after.

learn64bit

new idea
input files
  a and b
output files
  c,a1 and b2
   c
    contain lines in a and b
   a1
    contain lines only in a
   b1
    contain lines only in b

it means we need 5 memory blocks, 1 block is 1gb.
oh man... I wish my machine have 64gb or 1tb RAM!

if this idea failed, I will try Timo's idea

jj2007

Quote from: learn64bit on December 02, 2022, 12:21:28 AM
nes idea

Is that English?

Seriously, your absolutely incomprehensible, confused posts will not get you the help you want. Ranting about gigabytes needed is not helpful, either. What you do need to do:
- prepare two test files A.txt and B.txt, no more than one MB each
- post them here (if you manage to keep the zip below 512MB) or elsewhere
- tell us exactly what you need, and how C.txt should look like

I am trying to be helpful :thup:

learn64bit

written bytes didn't show up... in picture...maybe just I run a old copy to capture the pic

jj2007

Quote from: learn64bit on December 02, 2022, 12:35:00 AM
written bytes didn't show up... in picture...maybe just I run a old copy to capture the pic

Again, an absolutely incomprehensible, confused comment. You don't want help, right?

zedd151

Okay, I have given this some thought...
learn64bit, do you want to copy text from a.txt and b.txt to file c.txt and remove bytes that might be 0h or OFFh?
Is that what you were after in your original post (post #1 in this thread)?


Also do you want the lines ending with only 0D0Ah? And remove if contain only 0Ah? Or do you want to convert from 0Ah to 0D0Ah?


Does that sound like what you want to do? If not than try to explain it so that we can understand what you need since so far, no one can decipher what you want to do.

learn64bit

1 line c example
0Ah
2 lines c example
0Ah 0Dh 0Ah
00h
3 lines c example
0Ah 0Dh 0Ah
00h 0Dh 0Ah
FFh

if last line is
0Ah 0Dh 0Ah
or
FFh 0Dh 0Ah
or
00h 0Dh 0Ah 0Dh 0Ah
it's ok. because I don't care empty lines at all

jj2007

Quote from: learn64bit on December 02, 2022, 01:26:44 AM
1 line c example
0Ah
2 lines c example
0Ah 0Dh 0Ah
00h
3 lines c example
0Ah 0Dh 0Ah
00h 0Dh 0Ah
FFh

I give up, folks. Back to coding :tongue:

zedd151

It seems you are wanting to copy a.txt to c.txt,
Then append b.txt to the c.txt file created when copying a.txt -> c.txt in the line above? Does that describe what you want?


That would be trivial if that is the case.

learn64bit

BTW: no duplicate noneEmptyLine in a or b, every noneEmtryLine in a  is uniqueLine in a

if a is 800mb and b is 900mb, then c's maximum size should be 800mb.

zedd151

Okay, I think I understand...


Copy a.txt to c.txt


If b.txt contains a line that is not in a.txt, copy that to c.txt?


Is a.txt almost the same as b.txt, except b.txt has an added line? Is that correct?