summaryrefslogtreecommitdiff
path: root/helpcontent2/source/text/sbasic/shared/03020103.xhp
diff options
context:
space:
mode:
Diffstat (limited to 'helpcontent2/source/text/sbasic/shared/03020103.xhp')
-rw-r--r--helpcontent2/source/text/sbasic/shared/03020103.xhp112
1 files changed, 112 insertions, 0 deletions
diff --git a/helpcontent2/source/text/sbasic/shared/03020103.xhp b/helpcontent2/source/text/sbasic/shared/03020103.xhp
new file mode 100644
index 0000000000..1bab125cd9
--- /dev/null
+++ b/helpcontent2/source/text/sbasic/shared/03020103.xhp
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRUNTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc..
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************-->
+<helpdocument version="1.0">
+<meta>
+<topic id="textsbasicshared03020103xml" indexer="include" status="PUBLISH">
+<title xml-lang="en-US" id="tit">Open Statement[Runtime]</title>
+<filename>/text/sbasic/shared/03020103.xhp</filename>
+</topic>
+<history>
+<created date="2003-10-31T00:00:00">Sun Microsystems, Inc.</created>
+<lastedited date="2003-10-31T00:00:00">converted from old format - fpe</lastedited>
+</history>
+</meta>
+<body>
+
+
+ <section id="open">
+ <bookmark xml-lang="en-US" branch="index" id="bm_id3150791"><bookmark_value>Open;statement</bookmark_value></bookmark><paragraph id="hd_id3150791" role="heading" level="1" oldref="1" l10n="U" xml-lang="en-US"><link href="text/sbasic/shared/03020103.xhp" name="Open Statement[Runtime]">Open Statement[Runtime]</link></paragraph>
+ <paragraph role="paragraph" id="par_id3150769" l10n="U" xml-lang="en-US" oldref="2">Opens a data channel.</paragraph>
+ </section>
+ <paragraph role="heading" level="2" id="hd_id3147230" l10n="U" xml-lang="en-US" oldref="3">Syntax:</paragraph>
+ <paragraph role="paragraph" id="par_id3154124" l10n="U" xml-lang="en-US" oldref="4">Open FileName As String [For Modus] [Access IOMode] [protected] As [#]FileName As Integer [Len = Datasetlength]</paragraph>
+ <paragraph role="heading" level="2" id="hd_id3156280" l10n="U" xml-lang="en-US" oldref="5">Parameters:</paragraph>
+ <paragraph l10n="U" role="paragraph" id="par_id3155132" xml-lang="en-US" oldref="6"><emph>FileName: </emph>Name and path of the file that you wan to open. If you try to read a file that does not exist (Access = Read), an error message appears. If you try to write to a file that does exist (Access = Write), a new file is created.</paragraph>
+ <paragraph l10n="U" role="paragraph" id="par_id3149262" xml-lang="en-US" oldref="7"><emph>Mode:</emph> Keyword that specifies the file mode. Valid values: Append (append to sequential file), binary (data can be accessed by bytes using Get and Put), Input (opens data channel for reading), Output (opens data channel for writing), and Random (edits relative files).</paragraph>
+ <paragraph l10n="U" role="paragraph" id="par_id3154014" xml-lang="en-US" oldref="8"><emph>Access:</emph> Keyword that defines the access type. Valid values: Read (read-only), Write (write-only), Read Write (both).</paragraph>
+ <paragraph l10n="U" role="paragraph" id="par_id3150011" xml-lang="en-US" oldref="9"><emph>Protected:</emph> Keyword that defines the security status of a file after opening. Valid values: Shared (file may be opened by other applications), Lock Read (file is protected against reading), Lock Write (file is protected against writing), Lock Read Write (denies file access).</paragraph>
+ <paragraph l10n="U" role="paragraph" id="par_id3153190" xml-lang="en-US" oldref="10"><emph>FileNumber:</emph> Any integer expression from 0 to 511 to indicate the number of a free data channel. You can then pass commands through the data channel to access the file. The file number must be determined by the FreeFile function immediately before the Open statement.</paragraph>
+ <paragraph l10n="U" role="paragraph" id="par_id3151115" xml-lang="en-US" oldref="11"><emph>DatasetLength:</emph> For relative files, returns the length of a certain record. This parameter is only necessary if the file was opened for Random access.</paragraph>
+ <paragraph role="note" id="par_id3153418" l10n="U" xml-lang="en-US" oldref="12">You can only modify the contents of a file that was opened with the Open statement. If you try to open a file that is already open, an error message appears.</paragraph>
+ <paragraph role="heading" level="2" id="hd_id3149123" l10n="U" xml-lang="en-US" oldref="13">Example:</paragraph>
+ <paragraph role="paragraph" id="par_id3150749" l10n="U" xml-lang="en-US" oldref="14">Sub ExampleWorkWithAFile</paragraph>
+ <paragraph role="paragraph" id="par_id3155064" l10n="U" xml-lang="en-US" oldref="15">Dim iNumber As Integer</paragraph>
+ <paragraph role="paragraph" id="par_id3154754" l10n="U" xml-lang="en-US" oldref="16">Dim sLine As String</paragraph>
+ <paragraph role="paragraph" id="par_id3153711" l10n="U" xml-lang="en-US" oldref="17">Dim aFile As String</paragraph>
+ <paragraph role="paragraph" id="par_id3155764" l10n="U" xml-lang="en-US" oldref="40">Dim sMsg as String</paragraph>
+ <paragraph role="paragraph" id="par_id3159264" l10n="U" xml-lang="en-US" oldref="18">aFile = "c:\data.txt"</paragraph>
+
+ <paragraph role="paragraph" id="par_id3153963" l10n="U" xml-lang="en-US" oldref="20">iNumber = Freefile</paragraph>
+ <paragraph role="paragraph" id="par_id3155959" l10n="U" xml-lang="en-US" oldref="21">Open aFile For Output As #iNumber</paragraph>
+ <paragraph role="paragraph" id="par_id3154705" l10n="U" xml-lang="en-US" oldref="22">Print #iNumber, "This is a line of text"</paragraph>
+ <paragraph role="paragraph" id="par_id3146916" l10n="U" xml-lang="en-US" oldref="23">Print #iNumber, "This is another line of text"</paragraph>
+ <paragraph role="paragraph" id="par_id3150942" l10n="U" xml-lang="en-US" oldref="24">Close #iNumber</paragraph>
+
+ <paragraph role="paragraph" id="par_id3150300" l10n="U" xml-lang="en-US" oldref="28">iNumber = Freefile</paragraph>
+ <paragraph role="paragraph" id="par_id3154022" l10n="U" xml-lang="en-US" oldref="29">Open aFile For Input As iNumber</paragraph>
+ <paragraph role="paragraph" id="par_id3150783" l10n="U" xml-lang="en-US" oldref="30">While not eof(iNumber)</paragraph>
+ <paragraph role="paragraph" id="par_id3153270" l10n="U" xml-lang="en-US" oldref="31">Line Input #iNumber, sLine</paragraph>
+ <paragraph role="paragraph" id="par_id3153784" l10n="U" xml-lang="en-US" oldref="32">If sLine &lt;&gt;"" then</paragraph>
+ <paragraph role="paragraph" id="par_id3149208" l10n="U" xml-lang="en-US" oldref="33">sMsg = sMsg &amp; sLine &amp; chr(13)</paragraph>
+ <paragraph role="paragraph" id="par_id3150304" l10n="U" xml-lang="en-US" oldref="35">end if</paragraph>
+ <paragraph role="paragraph" id="par_id3151217" l10n="U" xml-lang="en-US" oldref="36">wend</paragraph>
+ <paragraph role="paragraph" id="par_id3152582" l10n="U" xml-lang="en-US" oldref="37">Close #iNumber</paragraph>
+ <paragraph role="paragraph" id="par_id3159100" l10n="U" xml-lang="en-US" oldref="41">Msgbox sMsg</paragraph>
+ <paragraph role="paragraph" id="par_id3159091" l10n="U" xml-lang="en-US" oldref="38">End Sub</paragraph>
+
+
+ </body>
+</helpdocument>