• ¡Welcome to Square Theme!
  • This news are in header template.
  • Please ignore this message.
مهمان عزیز خوش‌آمدید. ورود عضــویت


امتیاز موضوع:
  • 15 رای - 3.07 میانگین
  • 1
  • 2
  • 3
  • 4
  • 5
Title: نوشتن و خواندن در فایل
حالت موضوعی
#1
Binary Put/Get for Strings (with Unicode)

English:
نقل قول:More information: These functions allow you to write and read (put/get) strings to/from a file opened in binary-mode. A unicode-version is also included. All functions let you specify if you want to use a integer or long length-descriptor. If you choose integer the resulting file will be 2 bytes shorter than choosing long, but the string can only be 2^15-1 Bytes long.
Persian:
نقل قول:با تابع put میتونید در فایل بنویسید و با تابع get میتونید از فایل بخونید !
البته تو این روش یونیکد هم ساپورت میکنه به قول نویسنده کد


کد:
'www.parsicoders.cim
Function GetString(ByVal Filenumber As Integer, _
   ByVal Lng As Boolean) As String
    Dim StrLengthLng As Long
    Dim StrLengthInt As Integer
    Dim StrLength As Long

    If Lng Then
        Get #Filenumber, , StrLengthLng
        StrLength = StrLengthLng
    Else
        Get #Filenumber, , StrLengthInt
        StrLength = StrLengthInt
    End If
    GetString = String$(StrLength, " ")
    Get #Filenumber, , GetString
End Function

Sub PutString(ByVal Filenumber As Integer, Strng As String, _
   ByVal Lng As Boolean)
    If Lng Then
        Put #Filenumber, , CLng(Len(Strng))
    Else
        Put #Filenumber, , CInt(Len(Strng))
    End If
    Put #Filenumber, , Strng
End Sub

Function GetStringU(ByVal Filenumber As Integer, _
      ByVal Lng As Boolean) As String
    Dim StrLengthLng As Long
    Dim StrLengthInt As Integer
    Dim StrLength As Long

    If Lng Then
        Get #Filenumber, , StrLengthLng
        StrLength = StrLengthLng
    Else
        Get #Filenumber, , StrLengthInt
        StrLength = StrLengthInt
    End If
    
    If StrLength = 0 Then
        GetStringU = ""
    Else
        ReDim rwert(StrLength * 2 - 1) As Byte
        Get #Filenumber, , rwert
        GetStringU = rwert
    End If
End Function

Sub PutStringU(ByVal Filenumber As Integer, _
   Strng As String, ByVal Lng As Boolean)
    If Lng Then
        Put #Filenumber, , CLng(Len(Strng))
    Else
        Put #Filenumber, , CInt(Len(Strng))
    End If
    Dim b() As Byte
    b = Strng
    Put #Filenumber, , b
End Sub
گروه دور همی پارسی کدرز
https://t.me/joinchat/GxVRww3ykLynHFsdCvb7eg
 
پاسخ
  


موضوعات مشابه ...
موضوع نویسنده پاسخ بازدید آخرین ارسال
  کپی فایل aghamali 1 2,185 10-17-2017، 11:37 AM
آخرین ارسال: aghamali
  کد فراخوانی فایل متنی aghamali 4 5,042 06-28-2017، 02:45 PM
آخرین ارسال: aghamali
  چگونه فایل exe با ویژوال بیسیک بسازیم ؟ Amin_Mansouri 4 13,490 08-13-2015، 10:08 PM
آخرین ارسال: Amin_Mansouri
  ذخیره و فرخوانی فایل تکست aghamali 3 4,807 11-01-2014، 01:58 PM
آخرین ارسال: aghamali
  سورس کد دانلود فایل Amin_Mansouri 1 7,990 04-21-2014، 03:04 PM
آخرین ارسال: saelozahra
Wink ارسال فایل باftp بر روی هاست sajad-kh 0 2,858 04-08-2014، 07:29 PM
آخرین ارسال: sajad-kh
  دانلود فایل اکسس برای ساخت دیکشنری sajad-kh 0 4,912 01-28-2014، 01:24 PM
آخرین ارسال: sajad-kh
  خوندن سورس از فایل exe semolina 3 7,988 04-03-2013، 10:11 PM
آخرین ارسال: saeedusm
  خواندن از ریجستری gachboy 1 2,988 03-12-2013، 12:14 PM
آخرین ارسال: Amin_Mansouri
  سورس اپلود فایل از طریق Http Amin_Mansouri 7 12,088 12-05-2012، 12:11 AM
آخرین ارسال: rap0661

پرش به انجمن:


Browsing: 1 مهمان