Create a file: Difference between revisions

Rename Perl 6 -> Raku, alphabetize, minor clean-up
(corrected sorting of dc)
(Rename Perl 6 -> Raku, alphabetize, minor clean-up)
Line 16:
echos > \output.txt
mkdir \docs</lang>
 
=={{header|AArch64 Assembly}}==
{{works with|as|Raspberry Pi 3B version Buster 64 bits}}
Line 130 ⟶ 131:
 
</lang>
 
=={{header|Ada}}==
Notes:
Line 567 ⟶ 569:
(for creation in the filesystem root, replace the filenames by "/output.txt" and "/docs")
 
=={{header|ChucKC sharp|C#}}==
 
This creates a file in root:
<lang ccsharp>using System;
using System.IO;
FileIO text;
 
text.open("output.txt", FileIO.WRITE);
class Program {
</lang>
static void Main(string[] args) {
File.Create("output.txt");
File.Create(@"\output.txt");
 
Directory.CreateDirectory("docs");
Directory.CreateDirectory(@"\docs");
}
}</lang>
 
=={{header|C++}}==
Line 591 ⟶ 601:
}</lang>
 
=={{header|C sharp|C#ChucK}}==
This creates a file in root:
 
<lang csharpc>using System;
FileIO text;
using System.IO;
text.open("output.txt", FileIO.WRITE);
 
</lang>
class Program {
static void Main(string[] args) {
File.Create("output.txt");
File.Create(@"\output.txt");
 
Directory.CreateDirectory("docs");
Directory.CreateDirectory(@"\docs");
}
}</lang>
 
=={{header|Clojure}}==
Line 767 ⟶ 769:
=={{header|Dc}}==
<lang dc>! for d in . / ;do > "$d/output.txt" ; mkdir "$d/docs" ;done</lang>
 
=={{header|DCL}}==
<lang DCL>open/write output_file output.txt
open/write output_file [000000]output.txt
create/directory [.docs]
create/directory [000000.docs]</lang>
 
=={{header|Delphi}}==
Line 876 ⟶ 884:
 
</lang>
 
=={{header|DCL}}==
<lang DCL>open/write output_file output.txt
open/write output_file [000000]output.txt
create/directory [.docs]
create/directory [000000.docs]</lang>
 
=={{header|E}}==
Line 936 ⟶ 938:
(cd "~/")
(shell-command "touch output.txt & mkdir docs")</lang>
 
 
=={{header|Erlang}}==
Line 1,280 ⟶ 1,281:
=={{header|LabVIEW}}==
{{VI solution|LabVIEW_Create_a_file.png}}
 
 
=={{header|Lasso}}==
Line 1,300:
local(d = dir('//docs'))
#d->create</lang>
 
=={{header|LFE}}==
 
<lang lisp>
(: file write_file '"output.txt" '"Some data")
(: file make_dir '"docs")
(: file write_file '"/output.txt" '"Some data")
(: file make_dir '"/docs")
</lang>
 
=={{header|Liberty BASIC}}==
Filenames without drive and directory info. refer to the same directory as the LB program is running from.
<br>
Full pathnames including drive name and directory can be used- back-slash separated.
<lang lb>
nomainwin
 
open "output.txt" for output as #f
close #f
 
result = mkdir( "F:\RC")
if result <>0 then notice "Directory not created!": end
 
open "F:\RC\output.txt" for output as #f
close #f
 
end
</lang>
 
=={{header|Lingo}}==
Line 1,324 ⟶ 1,352:
shell_cmd("mkdir /Docs") -- mac</lang>
 
=={{header|Liberty BASIC}}==
Filenames without drive and directory info. refer to the same directory as the LB program is running from.
<br>
Full pathnames including drive name and directory can be used- back-slash separated.
<lang lb>
nomainwin
 
open "output.txt" for output as #f
close #f
 
result = mkdir( "F:\RC")
if result <>0 then notice "Directory not created!": end
 
open "F:\RC\output.txt" for output as #f
close #f
 
end
</lang>
=={{header|Little}}==
We are going to use /tmp instead the root.
Line 1,375 ⟶ 1,385:
create_dir("docs");
create_dir("/tmp/docs");</lang>
 
=={{header|LFE}}==
 
<lang lisp>
(: file write_file '"output.txt" '"Some data")
(: file make_dir '"docs")
(: file write_file '"/output.txt" '"Some data")
(: file make_dir '"/docs")
</lang>
 
=={{header|Lua}}==
Line 1,487 ⟶ 1,488:
 
:lisp (mapcar #'ensure-directories-exist '("docs/" "/docs/"))</lang>
 
 
=={{header|MAXScript}}==
Line 1,655:
open(directory & "output.txt", fmWrite).close()
createDir(directory & "docs")</lang>
 
=={{header|Objective-C}}==
 
<lang objc>NSFileManager *fm = [NSFileManager defaultManager];
 
[fm createFileAtPath:@"output.txt" contents:[NSData data] attributes:nil];
// Pre-OS X 10.5
[fm createDirectoryAtPath:@"docs" attributes:nil];
// OS X 10.5+
[fm createDirectoryAtPath:@"docs" withIntermediateDirectories:NO attributes:nil error:NULL];</lang>
 
=={{header|Objeck}}==
Line 1,685 ⟶ 1,675:
}
</lang>
 
=={{header|Objective-C}}==
 
<lang objc>NSFileManager *fm = [NSFileManager defaultManager];
 
[fm createFileAtPath:@"output.txt" contents:[NSData data] attributes:nil];
// Pre-OS X 10.5
[fm createDirectoryAtPath:@"docs" attributes:nil];
// OS X 10.5+
[fm createDirectoryAtPath:@"docs" withIntermediateDirectories:NO attributes:nil error:NULL];</lang>
 
=={{header|OCaml}}==
Line 1,704:
{OS.mkDir Dir#"docs" ['S_IRUSR' 'S_IWUSR' 'S_IXUSR' 'S_IXGRP']}
end</lang>
 
 
=={{header|PARI/GP}}==
Line 1,767 ⟶ 1,766:
<lang perl>unlink $_ for qw(/docs/output.txt ./docs/output.txt);
rmdir $_ for qw(/docs ./docs);</lang>
 
=={{header|Perl 6}}==
<lang perl6>
for '.', '' -> $prefix {
mkdir "$prefix/docs";
open "$prefix/output.txt", :w;
}
</lang>
 
=={{header|Phix}}==
Line 1,878 ⟶ 1,869:
(display-to-file "" "/output.txt")
(make-directory "/docs")</lang>
 
=={{header|Raku}}==
(formerly Perl 6)
<lang perl6>
for '.', '' -> $prefix {
mkdir "$prefix/docs";
open "$prefix/output.txt", :w;
}
</lang>
 
=={{header|Raven}}==
Line 1,916:
end /*2*/ /*now, go and perform them again.*/
/*stick a fork in it, we're done.*/</lang>
 
 
=={{header|Ring}}==
Line 1,931 ⟶ 1,930:
File.open(dir + 'output.txt', 'w') {} # create empty file /output.txt, then ./output.txt
}</lang>
 
=={{header|Run BASIC}}==
<lang RunBasic>open "output.txt" for output as #f
Line 1,940:
open "f:\doc\output.txt" for output as #f
close #f</lang>
 
=={{header|Rust}}==
<lang rust>use std::io::{self, Write};
Line 2,076 ⟶ 2,077:
host(1,'mkdir /docs')
end</lang>
 
=={{header|SQLite}}==
<lang sqlite3>
/*
*Use '/' for *nix. Use whatever your root directory is on Windows.
*Must be run as admin.
*/
.shell mkdir "docs";
.shell mkdir "/docs";
.output output.txt
.output /output.txt
</lang>
 
=={{header|SQL PL}}==
Line 2,133 ⟶ 2,122:
output.txt
</pre>
 
=={{header|SQLite}}==
<lang sqlite3>
/*
*Use '/' for *nix. Use whatever your root directory is on Windows.
*Must be run as admin.
*/
.shell mkdir "docs";
.shell mkdir "/docs";
.output output.txt
.output /output.txt
</lang>
 
=={{header|Standard ML}}==
Line 2,175 ⟶ 2,176:
" docs" &777 mkdir
" /docs" &777 mkdir</lang>
 
=={{header|TUSCRIPT}}==
<lang tuscript>
Line 2,183 ⟶ 2,185:
ERROR/STOP CREATE ("docs",project,-std-)
</lang>
 
=={{header|UNIX Shell}}==
 
Line 2,206 ⟶ 2,209:
f.createdir "/docs"
</lang>
 
=={{header|VBA}}==
<lang vb>Public Sub create_file()
Line 2,217 ⟶ 2,221:
Close #FreeFile
End Sub</lang>
 
=={{header|VBScript}}==
<lang vb>
Line 2,257 ⟶ 2,262:
IO.File.Create(IO.Path.DirectorySeparatorChar & "output.txt").Close()</lang>
 
=={{header|Visual Objects}}==
//Use Library System Library
<lang visualfoxpro>
DirMake(String2Psz("c:\docs"))
FCreate("c:\docs\output.txt", FC_NORMAL)
</lang>
 
{{omit from|SmileBASIC|Filesystem has no directories, only projects which cannot be manipulated by code.}}
 
=={{header|X86 Assembly}}==
Line 2,345 ⟶ 2,358:
 
<lang zxbasic>SAVE "OUTPUT" CODE 16384,0</lang>
 
=={{header|Visual Objects}}==
//Use Library System Library
<lang visualfoxpro>
DirMake(String2Psz("c:\docs"))
FCreate("c:\docs\output.txt", FC_NORMAL)
</lang>
 
{{omit from|SmileBASIC|Filesystem has no directories, only projects which cannot be manipulated by code.}}
10,327

edits