Input# Statement

खुल्ला अनुक्रमबद्ध फाइल नामबाट डेटा पढ्दछ ।

Syntax:

Input Statement diagram


Input #fileNum {,|;} var1 [, var2 [, ...]]

Parameters:

fileNum: Number of the file that contains the data that you want to read. The file must be opened with the Open statement using the key word INPUT.

var: A numeric or string variable that you assign the values read from the opened file to.

आगत#कथन सङ्ख्यात्मक मानमा पढ्नुहोस् वा खुला फाइलबाट स्ट्रिङहरू र डेटामा एक वा एकभन्दा बढी चलहरू मानाङ्कन गर्नुहोस् । सङ्ख्यात्मक चलले पहिलो फिर्ता लगेको (Asc=१३),रेखा फिड (Asc=१०), खाली स्थान वा अल्पविराम सम्म पढ्छ । स्ट्रिङहरू चलहरूले पहिलो फिर्ता लगेको (Asc=१३),रेखा फिड (Asc=१०), वा अल्पविराम सम्म पढ्छन् ।

परामितिरमा "var" पास भएका चलहरूको रूपमा उही क्रममा खुलेका फाइलमा डेटा र डेटा प्रकाहरू देखा पर्दछन् । यदि अ-सङ्ख्यात्मक मानहरू सङ्ख्यात्मक चलहरूलाई मानाङ्कन गरेको खण्डमा, "०"को मान"var"मा मानांङ्कन हुन्छ ।

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 Line Input# statement to read pure text files (files containing only printable characters) line by line.

डेटा तत्व पढिरहेको बेला फैल्याईएको फाइलको अन्त्य भएको खण्डमा त्रुटि आउछ र प्रक्रिया त्याग्नु पर्दछ ।

Example:


Sub ExampleWorkWithAFile
Dim iCount As Integer, sFileName As String
Dim sName As String, sValue As Integer
 
    sFileName = "C:\data.txt"
    iCount = Freefile
 
    ' Write data ( which we will read later with Input ) to file
    Open sFileName For Output As iCount
    sName = "Hamburg" : sValue = 200
    Write #iCount, sName, sValue
    sName = "New York" : sValue = 300
    Write #iCount; sName, sValue
    sName = "Miami" : sValue = 459
    Write #iCount, sName, sValue
    Close #iCount
 
    iCount = Freefile
    ' Read data file using Input
    Open sFileName For Input As iCount
    Input #iCount, sName, sValue
    MsgBox sName & " " & sValue
    Input #iCount; sName, sValue
    MsgBox sName & " " & sValue
    Input #iCount, sName, sValue
    MsgBox sName & " " & sValue
    Close #iCount
End Sub

Please support us!