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

sudoku

#361
1 minute and 40 seconds on my computer.
 The fastest version (from my computers perspective) so far.  :thumbsup:



:cool:

TimoVJL

intel have different CPUs for servers and desktops.
there are some memory issues, like what CPU support fast memory
AMD Ryzen family have similar problem.
May the source be with you

sinsi

Latest version
The current time is: 18:05:34.97
The current time is: 18:05:47.84

Previous version
The current time is: 18:04:13.45
The current time is: 18:04:19.22

sudoku

Quote from: sinsi on April 27, 2024, 06:37:10 PMLatest version
The current time is: 18:05:34.97
The current time is: 18:05:47.84

Previous version
The current time is: 18:04:13.45
The current time is: 18:04:19.22

Neither one of those look like
Quote10 seconds
:tongue:
Also hard to decipher those early in the morning, I haven't had my coffee yet.

Looks like the latest version V360 is slower for you, sinsi?
:cool:

sinsi

Quote from: sudoku on April 27, 2024, 11:53:57 PMNeither one of those look like
Quote10 seconds
:tongue:
Selective quoting? I actually said
Quote from: sinsi on April 26, 2024, 01:55:11 AMabout 10 seconds

Quote from: sudoku on April 27, 2024, 11:53:57 PMLooks like the latest version V360 is slower for you, sinsi?
Sorry, wrong way around  :sad:

Previous version
The current time is: 18:05:34.97
The current time is: 18:05:47.84
around 12 seconds

Latest version
The current time is: 18:04:13.45
The current time is: 18:04:19.22
around 6 seconds

Of course that assumes that the results are valid

sudoku

Quote from: sinsi on April 28, 2024, 12:24:55 AMOf course that assumes that the results are valid
Very true, only learn64bit knows for sure. If valid, it is faster..

learn64bit, how fast does V360 run on your computer, for comparison?

Quote from: sinsi on April 28, 2024, 12:24:55 AMSelective quoting? I actually said
Its extremely difficult to precisely copy and paste on my ancient ipad.  :tongue:  Thats my excuse, and I am sticking to it.

:cool:

learn64bit

new idea and new app:
  delete file and delete folder
  input: c.txt and c:\b
    c:\b is vs2022 buildtools installation folder

maybe it should be called deleteFile&emptyFolder

how should I do it?

sudoku

Quote from: learn64bit on April 28, 2024, 08:13:15 AMnew idea and new app:
  delete file and delete folder

  ...

how should I do it?
The easiest way would be to delete it (or them) using windows explorer.
Or even make a batch file for the task.  :greensml:
:cool:

learn64bit

Quote from: sudoku on April 28, 2024, 08:53:03 AM
Quote from: learn64bit on April 28, 2024, 08:13:15 AMnew idea and new app:
  delete file and delete folder

  ...

how should I do it?
The easiest way would be to delete it (or them) using windows explorer.
Or even make a batch file for the task.  :greensml:

windows explorer and 2000 files... not possible at all.
batch file can do tha? I don't think so.

delete all files which in c.txt, then delete all empty folders

sudoku

I was joking, of course.
Does this mean that you are finished with 'findline'?
:cool:

learn64bit

Quote from: sudoku on April 28, 2024, 09:03:28 AMI was joking, of course.
Does this mean that you are finished with 'findfile'?

no, not finished yet. but deleteFile&Folder is usefull to verify findLine's result

sudoku

Ah, okay. Do you have any code for the new program started yet? Or just still trying to come up with ideas?
:cool:

learn64bit

Quote from: sudoku on April 28, 2024, 09:07:24 AMAh, okay. Do you have any code for the new program started yet? Or just still trying to come up with ideas?

no idea, how to do it

sudoku

#374
Do some research on API "DeleteFile"...

Later....
I made you a small example using "DeleteFile".

You first need to open the file that you want to delete, using CreateFile to verify that the file exists.
If it exists, close the handle returned by CreateFile.
Then call DeleteFile.

If the file that you want to delete does not exist, display an error message.

This is very basic code.

Use caution using DeleteFile... it can be very dangerous, unless you know exactly what you are doing with it, and especially if you are going to run DeleteFile within untested code.

That being said, use at your own risk. I assume no responsibilty for misuse of this code, or accidentally deleted files. They (any accidentally deleted files) cannot be retreived from "Recycle Bin" after deletion. You have been warned.

    include \masm32\include\masm32rt.inc

    .data
        filename1  db "junktext1.txt", 0
        filename2  db "junktext2.txt", 0

    .code
    start:
        invoke CreateFile, addr filename1, 0, 0, 0, OPEN_EXISTING, 0, 0  ;;  to verify file exists
        cmp eax, -1
        jnz @f
        fn MessageBox, 0, "file not found", "file 1", 0    ;; display message if it doesn't exist.
        jmp nextfile
      @@:
        invoke CloseHandle, eax                            ;; close handle if file exists
        invoke DeleteFile, addr filename1                  ;; delete the file
      nextfile:

        invoke CreateFile, addr filename2, 0, 0, 0, OPEN_EXISTING, 0, 0  ;;  to verify file exists
        cmp eax, -1
        jnz @f
        fn MessageBox, 0, "file not found", "file 2", 0    ;; display message if it doesn't exist.
        jmp nomorefile
      @@:
        invoke CloseHandle, eax                            ;; close handle if file exists
        invoke DeleteFile, addr filename2                  ;; delete the file
      nomorefile:
     
        invoke ExitProcess, 0
       

    end start

:cool: