summaryrefslogtreecommitdiff
path: root/helpcontent2/source
diff options
context:
space:
mode:
authorAndras Timar <atimar@suse.com>2012-09-17 19:11:22 +0200
committerAndras Timar <atimar@suse.com>2012-09-17 19:11:22 +0200
commitaa0cd707987a3460e5f74ceda3f96515974cd011 (patch)
treecb452acb55f785c5639021c32b1d2e47bb601021 /helpcontent2/source
parent7aa886637aba596dcc79dfa107caad954beb5db8 (diff)
fdo#46704 replace wrong example to Noel Power's example
Change-Id: Iec4909f84cacf0a9d8d4228a4063287764fa0aa5
Diffstat (limited to 'helpcontent2/source')
-rw-r--r--helpcontent2/source/text/sbasic/shared/03020202.xhp57
1 files changed, 35 insertions, 22 deletions
diff --git a/helpcontent2/source/text/sbasic/shared/03020202.xhp b/helpcontent2/source/text/sbasic/shared/03020202.xhp
index 10289a255..7f8f5c70d 100644
--- a/helpcontent2/source/text/sbasic/shared/03020202.xhp
+++ b/helpcontent2/source/text/sbasic/shared/03020202.xhp
@@ -60,27 +60,40 @@
<paragraph role="paragraph" id="par_id3156442" xml-lang="en-US" l10n="CHG" oldref="10">Records that are separated by commas cannot be assigned to a string variable. Quotation marks (") in the file are disregarded as well. If you want to read these characters from the file, use the <emph>Line Input#</emph> statement to read pure text files (files containing only printable characters) line by line.</paragraph>
<paragraph role="paragraph" id="par_id3147349" xml-lang="en-US" l10n="U" oldref="11">If the end of the file is reached while reading a data element, an error occurs and the process is aborted.</paragraph>
<paragraph role="heading" id="hd_id3152578" xml-lang="en-US" level="2" l10n="U" oldref="12">Example:</paragraph>
-<paragraph role="code" id="par_id3144765" xml-lang="en-US" l10n="U" oldref="13">Sub ExampleWorkWithAFile</paragraph>
-<paragraph role="code" id="par_id3145799" xml-lang="en-US" l10n="U" oldref="14">Dim iNumber As Integer</paragraph>
-<paragraph role="code" id="par_id3145252" xml-lang="en-US" l10n="U" oldref="15">Dim sLine As String</paragraph>
-<paragraph role="code" id="par_id3149410" xml-lang="en-US" l10n="U" oldref="16">Dim aFile As String</paragraph>
-<paragraph role="code" id="par_id3149959" xml-lang="en-US" l10n="U" oldref="39">Dim sMsg as String</paragraph>
-<paragraph role="code" id="par_id3153417" xml-lang="en-US" l10n="U" oldref="17">aFile = "c:\data.txt"</paragraph>
-<paragraph role="code" id="par_id3150752" xml-lang="en-US" l10n="U" oldref="19">iNumber = Freefile</paragraph>
-<paragraph role="code" id="par_id3153707" xml-lang="en-US" l10n="U" oldref="20">Open aFile For Output As #iNumber</paragraph>
-<paragraph role="code" id="par_id3150321" xml-lang="en-US" l10n="U" oldref="21">Print #iNumber, "This is a line of text"</paragraph>
-<paragraph role="code" id="par_id3154756" xml-lang="en-US" l10n="U" oldref="22">Print #iNumber, "This is another line of text"</paragraph>
-<paragraph role="code" id="par_id3148408" xml-lang="en-US" l10n="U" oldref="23">Close #iNumber</paragraph>
-<paragraph role="code" id="par_id3155937" xml-lang="en-US" l10n="U" oldref="27">iNumber = Freefile</paragraph>
-<paragraph role="code" id="par_id3154702" xml-lang="en-US" l10n="U" oldref="28">Open aFile For Input As iNumber</paragraph>
-<paragraph role="code" id="par_id3155959" xml-lang="en-US" l10n="U" oldref="29">While not eof(iNumber)</paragraph>
-<paragraph role="code" id="par_id3145232" xml-lang="en-US" l10n="U" oldref="30">Line Input #iNumber, sLine</paragraph>
-<paragraph role="code" id="par_id3147345" xml-lang="en-US" l10n="U" oldref="31">If sLine &lt;&gt;"" then</paragraph>
-<paragraph role="code" id="par_id3150298" xml-lang="en-US" l10n="U" oldref="32">sMsg = sMsg &amp; sLine &amp; chr(13)</paragraph>
-<paragraph role="code" id="par_id3154021" xml-lang="en-US" l10n="U" oldref="34">end if</paragraph>
-<paragraph role="code" id="par_id3154665" xml-lang="en-US" l10n="U" oldref="35">wend</paragraph>
-<paragraph role="code" id="par_id3155607" xml-lang="en-US" l10n="U" oldref="36">Close #iNumber</paragraph>
-<paragraph role="code" id="par_id3153268" xml-lang="en-US" l10n="U" oldref="40">Msgbox sMsg</paragraph>
-<paragraph role="code" id="par_id3152584" xml-lang="en-US" l10n="CHG" oldref="37">End Sub</paragraph>
+<bascode>
+<paragraph role="bascode" localize="false">Sub ExampleWorkWithAFile</paragraph>
+<paragraph role="bascode" localize="false">Dim iCount As Integer</paragraph>
+<paragraph role="bascode" localize="false">Dim sName As String</paragraph>
+<paragraph role="bascode" localize="false">Dim sValue As Integer</paragraph>
+<paragraph role="bascode" localize="false">Dim sFileName as String</paragraph>
+<paragraph role="bascode" localize="false"> </paragraph>
+<paragraph role="bascode" localize="false">sFileName = "c:\data.txt"</paragraph>
+<paragraph role="bascode" localize="false">iCount = Freefile</paragraph>
+<paragraph role="bascode" localize="false"> </paragraph>
+<paragraph role="bascode" id="par_id4144765" xml-lang="en-US">' Write data ( which we will read later with Input ) to file</paragraph>
+<paragraph role="bascode" localize="false">Open sFileName for OutPut as iCount</paragraph>
+<paragraph role="bascode" localize="false">sName = "Hamburg"</paragraph>
+<paragraph role="bascode" localize="false">sValue = 200</paragraph>
+<paragraph role="bascode" localize="false">Write #iCount, sName, sValue</paragraph>
+<paragraph role="bascode" localize="false">sName = "New York"</paragraph>
+<paragraph role="bascode" localize="false">sValue = 300</paragraph>
+<paragraph role="bascode" localize="false">Write #iCount, sName, sValue</paragraph>
+<paragraph role="bascode" localize="false">sName = "Miami"</paragraph>
+<paragraph role="bascode" localize="false">sValue = 459</paragraph>
+<paragraph role="bascode" localize="false">Write #iCount, sName, sValue</paragraph>
+<paragraph role="bascode" localize="false">Close #iCount</paragraph>
+<paragraph role="bascode" localize="false"> </paragraph>
+<paragraph role="bascode" localize="false">iCount = Freefile</paragraph>
+<paragraph role="bascode" id="par_id4144766" xml-lang="en-US">' Read data file using Input</paragraph>
+<paragraph role="bascode" localize="false">Open sFileName for Input as iCount</paragraph>
+<paragraph role="bascode" localize="false">Input #iCount; sName, sValue</paragraph>
+<paragraph role="bascode" localize="false">Msgbox sName &amp; " " &amp; sValue</paragraph>
+<paragraph role="bascode" localize="false">Input #iCount; sName, sValue</paragraph>
+<paragraph role="bascode" localize="false">Msgbox sName &amp; " " &amp; sValue</paragraph>
+<paragraph role="bascode" localize="false">Input #iCount; sName, sValue</paragraph>
+<paragraph role="bascode" localize="false">Msgbox sName &amp; " " &amp; sValue</paragraph>
+<paragraph role="bascode" localize="false">Close #iCount</paragraph>
+<paragraph role="bascode" localize="false">End Sub</paragraph>
+</bascode>
</body>
</helpdocument>