Jump to content

Talk:Delete a file

From Rosetta Code
(Redirected from Talk:File/Delete)

On the one hand this task says "assume current path" - on the other hand it says "/input.txt" which is in the root of the file system in windows, linux and MacOS at least since OS X. Is the task to delete two files and directories, one that is 'here' and one that is in the root? This is truly unclear to me.Sgeier 01:08, 8 April 2007 (EDT)

While I'm at it: "for the second test" doesn't make sense - is the task to test something or to delete something? Color me puzzled. Sgeier 01:10, 8 April 2007 (EDT)
You're right, neither component makes sense. The task is still small; Season it to taste. --Short Circuit 10:41, 9 April 2007 (EDT)
OK, I tried to change the wording to clarify what I think the original poster meant. I'll make the same change to the other "file primitives". By all means holler at me if you think this is not what was really meant. Sgeier 00:15, 25 April 2007 (EDT)

Algol68g solution works but with warnings

This is on MacOS Sequoia (15.0.1)

Algol68g was installed from MacPorts

a68g --version
Algol 68 Genie 3.5.5
Copyright 2001-2024 Marcel van der Veer <algol68g@xs4all.nl>.

This is free software covered by the GNU General Public License.
There is ABSOLUTELY NO WARRANTY for Algol 68 Genie;
not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.

Please report bugs to Marcel van der Veer <algol68g@xs4all.nl>.

With plugin-compilation support
With parallel-clause support
With curl 8.10.1
With GNU Scientific Library 2.8
With ncurses 6.5
Build level 2.1212 clang Aug 31 2024
5     main:(
      1
a68g: warning: 1: further diagnostics suppressed, in particular-program.
9         INT errno = open(actual file, file name, stand back channel);
              1
a68g: warning: 1: declaration hides prelude declaration of PROC INT "errno".
17      remove("input.txt");
        1
a68g: warning: 1: value of INT call will be voided, in closed-clause starting at "(" in line 5.
18      remove("/input.txt");
        1
a68g: warning: 1: value of INT call will be voided, in closed-clause starting at "(" in line 5.
19      remove("docs");
        1
a68g: warning: 1: value of INT call will be voided, in closed-clause starting at "(" in line 5.
20      remove("/docs")
        1
a68g: warning: 1: value of INT call will be voided, in closed-clause starting at "(" in line 5.

Retired Build Engineer (talk)

Hi Retired Build Engineer - this is quite an old sample and probably pre-dates my joining Rosetta Code.
As someone noted in the past, it doesn't work anyway : (.
Did it actually delete the files and folders when you ran it ? Scratch shouldn't delete files that weren't created by the program as temporary files ?
In order to get it to work, it has to use OS commands - I'm using Windows so it won't work as-is on MacOS - you'll need to change the values of root, del and rmdir to get it to work on your system.
I've fixed the warnings.
--Tigerofdarkness (talk) 19:20, 4 October 2024 (UTC)

C++ solution fails for MacOS using Clang++


Assumes Windows platform?

./delete_a_file.cpp:2:10: fatal error: 'direct.h' file not found
    2 | #include <direct.h>
      |          ^~~~~~~~~~
1 error generated.

Retired Build Engineer (talk)

Or the problem could be clang which changes its headers every major version. You could try an older version of clang or replacing <direct.h> with <unistd.h> good luck,--Nigel Galloway (talk) 15:50, 4 October 2024 (UTC)
Cookies help us deliver our services. By using our services, you agree to our use of cookies.