-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path580.html
More file actions
176 lines (176 loc) · 8.12 KB
/
Copy path580.html
File metadata and controls
176 lines (176 loc) · 8.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>SmallBASIC | ACCESS</title>
<meta name="description" content="Returns the access rights of the file.">
<link rel="canonical" href="580">
<link rel="keywords" href="ACCESS (file)">
<link rel="stylesheet" href="/css/style.css">
<link rel="icon" type="image/png" href="/images/sb-desktop-32x32.png">
<script src="/clipboard.js"></script>
</head>
<body>
<button onclick="topFunction()" id="BackToTopBtn" title="Go to top">⯅</button>
<script src="/backtotop.js"></script>
<div class="wrapAll clearfix">
<nav class="navigation">
<div class="logo">
<a href="/"><img src='/images/sb-logo.png?v=2' alt="logo"></a>
</div>
<div class="navlinks">
<a href="/pages/download.html">Download</a>
<a href="/pages/news.html">News</a>
<a href="/pages/community.html">Community</a>
<a href="/pages/articles.html">Resources</a>
<a class='active' href="/pages/reference.html">Language Reference</a>
<a href="/pages/guide.html">SmallBASIC Manual</a>
</div>
</nav>
<div class="mainsection">
<div class="tabs clearfix">
<div class="tabsRight">
<a target="_github" href="https://github.com/smallbasic/smallbasic.github.io/blob/master/_build/reference/580-file-access.markdown">Edit</a>
<a target="_github" href="https://github.com/smallbasic/smallbasic.github.io/commits/master/_build/reference/580-file-access.markdown">History</a>
</div>
</div>
<div class="article">
<h1>ACCESS</h1>
<blockquote>n = ACCESS (file)</blockquote>
<div class="siteSub">
<p>
<a href="/">Home</a> >
<a href="/pages/reference.html">Reference</a> >
<a href="/pages/file.html">File</a>
</p>
</div>
<p>Returns the access rights of a file. The string <code>file</code>
follows OS file naming conventions. The returned file permission number
<code>n</code> follows the permission pattern of the chmod() and stat()
system calls. The bits of <code>n</code> (in octal) are:</p>
<table>
<thead>
<tr class="header">
<th style="text-align: center;">Bits</th>
<th style="text-align: left;">Permission</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: center;">0o4000</td>
<td style="text-align: left;">set user ID on execution</td>
</tr>
<tr class="even">
<td style="text-align: center;">0o2000</td>
<td style="text-align: left;">set group ID on execution</td>
</tr>
<tr class="odd">
<td style="text-align: center;">0o1000</td>
<td style="text-align: left;">sticky bit</td>
</tr>
<tr class="even">
<td style="text-align: center;">0o400</td>
<td style="text-align: left;">read by owner</td>
</tr>
<tr class="odd">
<td style="text-align: center;">0o200</td>
<td style="text-align: left;">write by owner</td>
</tr>
<tr class="even">
<td style="text-align: center;">0o100</td>
<td style="text-align: left;">execute/search by owner</td>
</tr>
<tr class="odd">
<td style="text-align: center;">0o40</td>
<td style="text-align: left;">read by group</td>
</tr>
<tr class="even">
<td style="text-align: center;">0o20</td>
<td style="text-align: left;">write by group</td>
</tr>
<tr class="odd">
<td style="text-align: center;">0o10</td>
<td style="text-align: left;">execute/search by group</td>
</tr>
<tr class="even">
<td style="text-align: center;">0o4</td>
<td style="text-align: left;">read by others</td>
</tr>
<tr class="odd">
<td style="text-align: center;">0o2</td>
<td style="text-align: left;">write by others</td>
</tr>
<tr class="even">
<td style="text-align: center;">0o1</td>
<td style="text-align: left;">execute/search by others</td>
</tr>
</tbody>
</table>
<h3 id="example">Example</h3>
<div class="sourceCode" id="cb1"><pre
class="sourceCode smallbasic"><code class="sourceCode smallbasic"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="kw">IF ACCESS</span>(<span class="st">"/bin/sh"</span>) <span class="kw">AND</span> <span class="dv">0o4</span> <span class="kw">THEN</span></span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a> <span class="kw">PRINT</span> <span class="st">"Others can read the file"</span></span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a><span class="kw">ENDIF</span></span></code></pre></div>
<div class="lavenderBox">
<div class="header">Code samples using ACCESS</div>
<div class="linklist">
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/getting started/000 hello.bas">000 hello.bas </a>
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/getting started/001 3 ways to print hello 5 times.bas">001 3 ways to print hello 5 times.bas </a>
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/getting started/002 numeric variables.bas">002 numeric variables.bas </a>
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/getting started/003 conditional branching.bas">003 conditional branching.bas </a>
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/getting started/004 loops.bas">004 loops.bas </a>
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/getting started/005 challenge.bas">005 challenge.bas </a>
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/getting started/006 arrays+.bas">006 arrays+.bas </a>
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/games 3/checkers.bas">checkers.bas </a>
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/games 3/chess.bas">chess.bas </a>
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/applications/palm_cli.bas">palm_cli.bas </a>
</div>
</div>
<div class="lavenderBox">
<div class="header">File</div>
<div class="linklist">
<a href="/reference/580.html"><strong>ACCESS</strong> </a>
<a href="/reference/602.html">BGETC </a>
<a href="/reference/582.html">BLOAD </a>
<a href="/reference/583.html">BPUTC </a>
<a href="/reference/584.html">BSAVE </a>
<a href="/reference/585.html">CHDIR </a>
<a href="/reference/586.html">CHMOD </a>
<a href="/reference/587.html">CLOSE </a>
<a href="/reference/588.html">COPY </a>
<a href="/reference/589.html">DIRWALK </a>
<a href="/reference/603.html">EOF </a>
<a href="/reference/604.html">EXIST </a>
<a href="/reference/605.html">FILES </a>
<a href="/reference/607.html">FREEFILE </a>
<a href="/reference/590.html">INPUT </a>
<a href="/reference/608.html">INPUT </a>
<a href="/reference/591.html">KILL </a>
<a href="/reference/592.html">LOCK </a>
<a href="/reference/609.html">LOF </a>
<a href="/reference/593.html">MKDIR </a>
<a href="/reference/594.html">OPEN </a>
<a href="/reference/601.html">READ </a>
<a href="/reference/595.html">RENAME </a>
<a href="/reference/596.html">RMDIR </a>
<a href="/reference/597.html">SEEK </a>
<a href="/reference/610.html">SEEK </a>
<a href="/reference/598.html">TLOAD </a>
<a href="/reference/599.html">TSAVE </a>
<a href="/reference/600.html">WRITE </a>
</div>
</div>
</div>
<div class="pagefooter">
This page was last edited on Fri, 15 Sep 2023 15:18:46 +0200
|
<a href="https://en.wikipedia.org/wiki/Markdown" target="_blank" rel="nofollow">Markdown</a>
processed with
<a href="https://pandoc.org/MANUAL.html#pandocs-markdown" target="_blank" rel="nofollow">pandoc 3.1.12.1</a>
</div>
</div>
</div>
</body>
</html>