Put# Statement

መዝገብ ወደ አንፃራዊ ፋይል መጻፊያ ወይንም ተከታታይ ባይቶች ወደ ባይነሪ ፋይል ውስጥ መጻፊያ

tip

Use Print# statement to print data to a sequential text file. Use Write# statement to write data to a sequential text file with delimiting characters.


አገባብ:

Put Statement diagram


Put [#]fileNum, [recordNum|filePos], variable

ደንቦች:

fileNum: Any integer expression that defines the file that you want to write to.

recordNum, filePos: For relative files (random access files), the number of the record that you want to write.

ለ binary ፋይሎች (binary access), በ ፋይል ውስጥ የ ባይት ቦታ ነው እርስዎ መጻፍ መጀመር የሚፈልጉበት

variable: Name of the variable that you want to write to the file.

ማስታወሻ ለ አንፃራዊ ፋይሎችተለዋዋጭ ከ መዝገብ እርዝመት ጋር ካልተመሳሰለ በ ተወሰነው በ Len clause በ መክፈቻ አረፍተ ነገር ውስጥ: በ መጨረሻው ቦታ ውስጥ በ መዝገብ የተጻፈው እና አዲስ በ ተጻፈው መዝገብ መጨረሻ እና በሚቀጠለው መዝገብ መካከል ከ ነበረው ፋይል ውስጥ ዳታ ይሞላል እርስዎ ወደሚጽፉበት

ማስታወሻ ለ binary ፋይሎች: የ ተለዋዋጭ ይዞታዎች ይጻፋሉ በ ተወሰነው ቦታ እና የ ፋይል መጠቆሚያ በ ቀጥታ ይገባል ከ መጨረሻው ባይት በኋላ: ምንም ባዶ ቦታ አይኖርም በ መዝገቦች መካከል

ለምሳሌ:

ለምሳሌ:


Sub ExampleRandomAccess
    Dim iNumber As Integer
    Dim sText As Variant ' Must be a variant
    Dim aFile As String
    aFile = "c:\data.txt"
    iNumber = Freefile
    Open aFile For Random As #iNumber Len=32
    Seek #iNumber,1 ' Position at beginning
    Put #iNumber,, "This is the first line of text" ' Fill line with text
    Put #iNumber,, "This is the second line of text"
    Put #iNumber,, "This is the third line of text"
    Seek #iNumber,2
    Get #iNumber,,sText
    Print sText
    Close #iNumber
    iNumber = Freefile
    Open aFile For Random As #iNumber Len=32
    Get #iNumber,2,sText
    Put #iNumber,,"This is a new text"
    Get #iNumber,1,sText
    Get #iNumber,2,sText
    Put #iNumber,20,"This is the text in record 20"
    Print Lof(#iNumber)
    Close #iNumber
End Sub