Author Topic: v1.5 128 bit (and beyond) math *** COMPILER ERROR ***  (Read 30489 times)

0 Members and 1 Guest are viewing this topic.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • Steve’s QB64 Archive Forum
Re: QB64 v1.5 MOVe & REName statements for files and directories
« Reply #60 on: September 25, 2020, 02:49:19 pm »
@Richard For Move and Rename, check my API collection zip or the forum link here: https://www.qb64.org/forum/index.php?topic=3034.msg123040#msg123040
I used the WinAPI to write code to allow for Move, Copy, Rename, Recycle, and Empty Recycle Bin. Maybe this is what could be used for 1.5?

We already have the NAME command, which renames, or moves, a file.

NAME “C:\QB64\temp.bas” AS “C:\QB64\temp\temp.bas”  <— This will move temp.bas from the QB64 folder to the QB64\temp folder.



For a file copy:

OPEN “yourfile.ext” FOR BINARY AS #1
OPEN “yourcopy.ext” FOR BINARY AS #2
l = LOF(1)
temp$ = SPACE$(l)
GET #1, 1, temp$
PUT #2, 1, temp$
CLOSE
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • GitHub
Re: QB64 v1.5 MOVe & REName statements for files and directories
« Reply #61 on: September 25, 2020, 04:32:23 pm »
For a file copy:

OPEN “yourfile.ext” FOR BINARY AS #1
OPEN “yourcopy.ext” FOR BINARY AS #2
l = LOF(1)
temp$ = SPACE$(l)
GET #1, 1, temp$
PUT #2, 1, temp$
CLOSE
@SMcNeill
That seems like a lot of lines just to say copy from here to here. At that point you might as well just SHELL and use some CMD command. Besides, since mine uses the built in Windows functions it actually gives confirmation dialogs to prevent overwrites and such. Does NAME AS create the directory if it doesn't exist or does the directory have to exist?
« Last Edit: September 25, 2020, 04:33:55 pm by SpriggsySpriggs »
Shuwatch!

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • Steve’s QB64 Archive Forum
Re: QB64 v1.5 MOVe & REName statements for files and directories
« Reply #62 on: September 25, 2020, 04:35:55 pm »
That seems like a lot of lines just to say copy from here to here. At that point you might as well just SHELL and use some CMD command. Besides, since mine uses the built in Windows functions it actually gives confirmation dialogs to prevent overwrites and such.

Just make it a single SUB.  SHELL comes with several issues, such as OS dependency, and user permissions.  I tend to find it best to handle program execution internally, when possible, rather than just shelling out for everything.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • GitHub
Re: QB64 v1.5 MOVe & REName statements for files and directories
« Reply #63 on: September 25, 2020, 04:49:27 pm »
Just make it a single SUB.  SHELL comes with several issues, such as OS dependency, and user permissions.  I tend to find it best to handle program execution internally, when possible, rather than just shelling out for everything.
Which is why I used the WinAPI functions found in Shell32 so I could have all the nice things that Windows offers with the confirmation dialogs and progress bars and creation of directories if they don't already exist when doing a copy or move. I know you can write in message boxes and check for directories and files existing but why not just let Windows handle it since, after all, it is a Windows program. I don't write things for Linux or Mac because I haven't found Linux or Mac to be good solutions for me as alternative operating systems. I'm a Windows man.
Shuwatch!

Offline Richard

  • Seasoned Forum Regular
  • Posts: 364
Re: QB64 v1.5 MOVE & RENAME statements files/directories, IDE hotkey expansion
« Reply #64 on: September 25, 2020, 09:00:28 pm »
Quote

Try NAME: https://www.qb64.org/wiki/NAME

NAME "BIGBAD.TXT" AS "BADWOLF.TXT"


@Steve - thanks - it even works with filenames containing spaces (without having to pre- post- attach CHR$(&H22) for SHELL … as I had to before)

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • GitHub
Re: QB64 v1.5 MOVE & RENAME statements files/directories, IDE hotkey expansion
« Reply #65 on: September 25, 2020, 10:21:49 pm »
@Richard This is how this works:
Code: QB64: [Select]
  1. A = Move(_DIR$("desktop") + "QB64 x64\test.txt", _DIR$("desktop") + "test.txt")

 [ You are not allowed to view this attachment ]  
Shuwatch!

Offline Richard

  • Seasoned Forum Regular
  • Posts: 364
Re: QB64 v1.5 MOVE & RENAME files/directories,IDE hotkey expansion, Win KB->bytes
« Reply #66 on: September 25, 2020, 10:50:23 pm »
This maybe beyond the scope of QB64 but...

Any way (as an option) that QB64 on startup (or in a program) override Windows File Explorer displaying of file sizes in KB, rather display as bytes (comma separated)?

I have been "caught out" many times using Windows File explorer when it shows two files as the same size (in KB) but often the file sizes differ by a few bytes. I suspect that I had problems of using the File Explorer to merge files together and it tells the files are the same size (but I guess it seems only in KB) and so I allowed Windows not to keep two files the same size (KB) etc.

To display bytes (rather than KB) would only occupy display real estate of only 1 extra character.


I know that I can use for instance DOS CMD for file sizes (bytes), also use QB64 LOF(…) for program investigation of files sizes, and also that there are 3rd party software that do this. However, for convenience, it would be nice if Windows File Explorer was "modified" to display (as an option) file sizes in bytes.

I have searched the internet on the solution - but it appears Windows does not want anyone to change file size display.

Is there a way to do this - eg Registry setting  or  even a Windows API to do this?

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • GitHub
Re: QB64 v1.5 MOVE & RENAME files/directories,IDE hotkey expansion, Win KB->bytes
« Reply #67 on: September 25, 2020, 11:00:46 pm »
I know that I can use for instance DOS CMD for file sizes (bytes), also use QB64 LOF(…) for program investigation of files sizes, and also that there are 3rd party software that do this. However, for convenience, it would be nice if Windows File Explorer was "modified" to display (as an option) file sizes in bytes.
Is there a way to do this - eg Registry setting  or  even a Windows API to do this?

@Richard I will check all over the Internet for registry values concerning this. I remember making a C# program that edited the registry so I will see what I can do.
Shuwatch!

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • GitHub
Re: QB64 v1.5 MOVE & RENAME files/directories,IDE hotkey expansion, Win KB->bytes
« Reply #68 on: September 25, 2020, 11:31:18 pm »
Quite unfortunately there is no way to do it. According to Microsoft, you can download a third party application to see the true file size but you cannot change the computer in any way (supposedly) to show it differently. Oh well.
Shuwatch!

Offline Richard

  • Seasoned Forum Regular
  • Posts: 364
Re: QB64 v1.5 MOVE & RENAME files/directories,IDE hotkey expansion, Win KB->bytes
« Reply #69 on: September 25, 2020, 11:49:27 pm »
@SpriggsySpriggs

Thanks for trying.


As a cheap, nasty, dirty, backdoor approach to the problem...

Is there a way for QB64 (in a program) to interrogate the File Explorer currently running to "see" the "Details Pane" (ie the files/folders and which usually displays file sizes (KB)) - then in my program I would at say 6 second intervals - display my small program display window which would eg CMD do a directory listing of the CURRENT FOLDER in the "Navigation Pane".

This I could make automatic in my program to save doing it manually.


Summary:

CLIPBOARD "current FOLDER in Navigation Pane" for use by QB64?   

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
Re: QB64 v1.5 MOVE & RENAME files/directories,IDE hotkey expansion, Win KB->bytes
« Reply #70 on: September 26, 2020, 11:13:35 am »
This maybe beyond the scope of QB64 but...

Any way (as an option) that QB64 on startup (or in a program) override Windows File Explorer displaying of file sizes in KB, rather display as bytes (comma separated)?

I have been "caught out" many times using Windows File explorer when it shows two files as the same size (in KB) but often the file sizes differ by a few bytes. I suspect that I had problems of using the File Explorer to merge files together and it tells the files are the same size (but I guess it seems only in KB) and so I allowed Windows not to keep two files the same size (KB) etc.

To display bytes (rather than KB) would only occupy display real estate of only 1 extra character.


I know that I can use for instance DOS CMD for file sizes (bytes), also use QB64 LOF(…) for program investigation of files sizes, and also that there are 3rd party software that do this. However, for convenience, it would be nice if Windows File Explorer was "modified" to display (as an option) file sizes in bytes.

I have searched the internet on the solution - but it appears Windows does not want anyone to change file size display.

Is there a way to do this - eg Registry setting  or  even a Windows API to do this?

You know you can read a files byte size in the Properties Window of File Explorer?

The Explorer says all the All Digit files are 1K but I get the Byte Size from properties.

Here is Luke record to All Digits solution:
  [ You are not allowed to view this attachment ]  
« Last Edit: September 26, 2020, 11:16:20 am by bplus »

Offline Richard

  • Seasoned Forum Regular
  • Posts: 364
Re: QB64 v1.5 MOVE & RENAME files/directories,IDE hotkey expansion, Win KB->bytes
« Reply #71 on: September 26, 2020, 11:32:57 am »
@B+

Thanks for the reply - yes I knew of the Windows Properties feature.

However, when "eye-balling" a list say of over a thousand files - it becomes tiring to constantly get the file properties - I might as well just go to CMD window and do a directory listing (sort of defeats the purpose of having File Explorer).

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • Steve’s QB64 Archive Forum
Re: QB64 v1.5 MOVE & RENAME files/directories,IDE hotkey expansion, Win KB->bytes
« Reply #72 on: September 26, 2020, 12:20:09 pm »
@B+

Thanks for the reply - yes I knew of the Windows Properties feature.

However, when "eye-balling" a list say of over a thousand files - it becomes tiring to constantly get the file properties - I might as well just go to CMD window and do a directory listing (sort of defeats the purpose of having File Explorer).

You might give this a shot: https://www.smartftp.com/en-us/sizeinbytes

It’s supposedly a tool which alters explorer to show byte size instead of kb size, but I haven’t used it, nor do I actually know the developer.  Junk like that always makes me wary of spamware, spyware, and crap which might be included with it.  If anyone has a bare bones system, or a sandbox for testing first, I’d definitely let them give it a go before trying it on my work machine.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
Re: QB64 v1.5 MOVE & RENAME files/directories,IDE hotkey expansion, Win KB->bytes
« Reply #73 on: September 26, 2020, 12:23:11 pm »
@B+

Thanks for the reply - yes I knew of the Windows Properties feature.

However, when "eye-balling" a list say of over a thousand files - it becomes tiring to constantly get the file properties - I might as well just go to CMD window and do a directory listing (sort of defeats the purpose of having File Explorer).

OK in view > details > sort by > size and the files are listed largest to smallest in bytes!

  [ You are not allowed to view this attachment ]  

Oh ha! Lukes is listed longest in EXE and Richard Frost as smallest but I check Properties and all 3 are exactly the same byte size in the EXE's.
« Last Edit: September 26, 2020, 12:27:43 pm by bplus »

Offline Richard

  • Seasoned Forum Regular
  • Posts: 364
Re: QB64 v1.5 MOVE & RENAME files/directories,IDE hotkey expansion, Win KB->bytes
« Reply #74 on: September 26, 2020, 01:02:47 pm »
Quote

You might give this a shot: https://www.smartftp.com/en-us/sizeinbytes

It’s supposedly a tool which alters explorer to show byte size instead of kb size, but I haven’t used it, nor do I actually know the developer.  Junk like that always makes me wary of spamware, spyware, and crap which might be included with it.  If anyone has a bare bones system, or a sandbox for testing first, I’d definitely let them give it a go before trying it on my work machine.

@Steve - many thanks - I took a gamble and installed on my Windows 10 x64 - it did not bring any issues (yet) or any action required with my Windows Defender Folder Protection for the WHOLE of  C Drive. I will let you know of any issues if this program causes on my machine.





  [ You are not allowed to view this attachment ]





Downloaded the free version (at bottom of webpage) - did not need paid version (for Client stuff)

WARNING   When "installing the .MSI"   ALL INSTANCES of Windows Explorer will be terminated!!!
« Last Edit: September 26, 2020, 10:17:27 pm by Richard »