ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ·Q½Ð°ÝExcelªº chr ¨ç¼Æªº°ÝÃD

[µo°Ý] ·Q½Ð°ÝExcelªº chr ¨ç¼Æªº°ÝÃD

¥»©«³Ì«á¥Ñ luhpro ©ó 2010-12-14 23:21 ½s¿è

Sub main()
  Dim sChar$

  Open "C:\test.bin" For Binary As #1
    sChar = Right(Chr(18), 1)
    Put #1, 1, sChar
    sChar = Right(Chr(54), 1)
    Put #1, 2, sChar
    sChar = Right(Chr(238), 1)
    Put #1, 3, sChar
  Close #1
End Sub

¦p¤W­zµ{¦¡,
·Q¼g¤J¦h­Ó«ü©w¦r¤¸¨ì ¤G¶i¦ì Àɮפº.

¸Õ¹L ·íascii½X¼Æ¤£¤j®É¼g¤Jªº¦r¤¸³£¥¿½T,
¦ý¨º­Ó shr(238) ·|Åܦ¨±N chr(0) ¼g¤JÀÉ®×,
§Y®Éµøµ¡¥´¤W ?asc(chr(238)) µ²ªG¤]¬O 0

¦ý Excel ¤¤Ãö©ó chr ªº»¡©ú¤W¦³µù©ú :
    charcode ¤Þ¼Æ¬O¤@­Ó¥Î¨ÓÃѧO¬Y¦r¤¸ªº Long¡C
¼Æ¦r«¬ºA¬° Long ¤£ª¾¬°¦ó 238 «oÂण¥X¥¿½Tªº¦r¤¸©O?

¯S®í¦r¤¸ Åã¥Ü¤£¥X¨Ó...
´Nª½±µ°Ý ?chr(238) ´NÅã¥Ü¤£¥X¨Ó¤F....
§Ú¤§«e¦³¤]¹J¹L ¬O¦³¨Ç¹q¸£¥i¥HPrint¥X¨Ó ¦³¨Ç¤£¦æ!
§Ú³Ì«á¬O§ï¨ä¥¦²Å¸¹¸Ñ¨M~
­Y¬O§Ú¦^µª¡A¨Ï±zº¡·N¡A½Ð±zÅý§Úª¾¹D¡I                  
­Y¬O§Úªº¦^ÂСA±z¤´¦³¨ä¥L¨£¸Ñ¡A¤]½Ð±z¤£¶Þ«ü±Ð¡I

TOP

¥»©«³Ì«á¥Ñ luhpro ©ó 2010-12-16 00:14 ½s¿è

¦^´_ 2# Min

§Ú¥D­nªº¥Î³~¬O­n¼g¨ì ¤G¶i¦ìÀÉ ¤º,
¦Ó¤£¬O·QÅã¥Ü¥X¨Ó¤å¦r,
§Ú¸Õ¹L¦b¦P¤@¥x¹q¸£¤¤¥Î C »y¨¥ ¥Î chr() ¨ç¼Æ¼g¤J¸Ó¦r¤¸¨ì ¤G¶i¦ìÀÉ ¬O¨S°ÝÃDªº.

¥D­n¬O¦b¤½¥q Excel ³nÅ骽±µ¥i¥H¨Ï¥Î,
¦ý C ê©óª©Åv°ÝÃD¦b¤½¥q¤£¯à¦w¸Ë¤Î¨Ï¥Î.

¦¹«e¤]¤w¸g¹ê²{¦¨¥\¨ä¤Ï¦V§@·~ : ±q¤G¶i¦ìÀɤ¤ÁÙ­ì¥X¥»¨Óªº¼Æ­È :

Sub Main()

  Dim iColumn%, iRow%
  Dim bData As Byte
  Dim lPosition As Long

  Close
  With Sheets("Sheet1")
    lPosition = 1
    Open "C:\test.bin" For Random As #1 Len = 1
      iColumn = 1
      iRow = 1
      
      While Not EOF(1)
        Get #1, lPosition, bData

        .Cells(iRow, iColumn) = bData
        iColumn = iColumn + 1
        
        If iColumn > 256 Then
          iColumn = 1
          iRow = iRow + 1
        End If
        lPosition = lPosition + 1
      Wend
   
    Close #1
  End With
  
End Sub

§Ú²q´ú¦b MS ªº Basic ¤W¹ê§@À³¸Ó¤]¤£·|¦³°ÝÃD,
¬O§_¬O§Ú¤§«e©Ò¥Îªº¤è¦¡¿ù»~,
¥ç©Î¦³¥i¯à¬O Excel VBA ¥»¨­´N¹ê²{¤£¥X¨Ó©O?
----------------------------------------------------------------
¸É¥R :
­è­è¤S¸ÕµÛ¥Î Random Àɪº¤è¦¡¹ê°µ¦¨¥\ :
Sub Main()

  Dim iI%
  Dim bChar As Byte
  Dim lPosition As Long

  Close
    lPosition = 1
    Open "C:\test1.bin" For Random As #1 Len = 1
      
      For iI = 255 To 0 Step -1
        bChar = iI
        Put #1, lPosition, bChar
        lPosition = lPosition + 1
      Next iI
   
    Close #1
  
End Sub

¦ý¤£ª¾ Binary ÀÉ (´`§Ç¼g¤J, ¤£¥ÎºÞ¤U­Ó¸ê®Æ­n¼g¨ìÀɮפ¤ªº²Ä´X­Ó¦ì¸m) ªº¶}±Ò¤è¦¡¤S­n¦p¦ó¹ê§@©O?

TOP

¬OÂà¤G¶i¦ìÁÙ¬OÂàAscii?
­Y¬O§Ú¦^µª¡A¨Ï±zº¡·N¡A½Ð±zÅý§Úª¾¹D¡I                  
­Y¬O§Úªº¦^ÂСA±z¤´¦³¨ä¥L¨£¸Ñ¡A¤]½Ð±z¤£¶Þ«ü±Ð¡I

TOP

¦^´_ 4# Min

?
¤G¶i¦ìÀɤ£´N¬O¼g¤J¦r¤¸ªº Ascii½X ¶Ü?
Ascii ½d³ò 0 ~ 255

TOP

¤£¤@¼Ë³á~
¤G¶i¦ì ´N¥u¦³0»P1...
http://zh.wikipedia.org/zh/Uuencode
­Y¬O§Ú¦^µª¡A¨Ï±zº¡·N¡A½Ð±zÅý§Úª¾¹D¡I                  
­Y¬O§Úªº¦^ÂСA±z¤´¦³¨ä¥L¨£¸Ñ¡A¤]½Ð±z¤£¶Þ«ü±Ð¡I

TOP

¥»©«³Ì«á¥Ñ luhpro ©ó 2010-12-19 19:19 ½s¿è

¦^´_ 6# Min
³o¸ò§Úªº²z¸Ñ¤£¦P©O.

§A©Òµ¹³sµ²¤¤´£¨ìªº uuencode ¬O¦b¶l¥ó¨t²Î¶Ç¿éªº¤@­Ó "½s½X" µ{¦¡¡A¬O¤@ºØ "¤G¶i¦ì" ¨ì "¤å¦r" ªº½s½X,
©Ò¥H¥¦¨Ã«D¬O¤@ºØ "¤G¶i¨îÀÉ®×".

­Y§Ú­Ì±q©³¤U³o­Ó³sµ²¤¤¬Ý :
¤å¦r¤å¥ó : http://zh.wikipedia.org/zh-tw/%E6%96%87%E5%AD%97%E6%AA%94  (´¡¤JÃì±µ¥\¯à¤£¯à¥Î?)
¸Ì­±¦³¤@¬q¸Ü­Ë¬O¥i¥H®Ú¥»ÄÄ©ú©Ò¿×ªº¤G¶i¨îÀɮ׬O«ç»ò¦^¨Æ :

¤@¯ë¨Ó»¡¡A¹q¸£¥i¥H¤À¬°¨âÃþ¡G ¤å¦r¤å¥ó ©M ¤G¶i¨îÀÉ®× ¡C

¤]´N¬O»¡¥u­n¤£¬O "¤å¦r¤å¥ó" ªº´N¬O "¤G¶i¨îÀÉ®×". (¥]¬A .EXEµ{¦¡ÀÉ ¬Æ¦Ü¬O .MP4 ­µ°TÀ£ÁYÀɳ£¬O, ®t§O¥u¦b©ó¨ä¥Î³~¤£¦P¦Ó¦³¨ä¯S©wªº "ÃѧO" ®æ¦¡¦s¦b)

¦Ó¤å¦rÀɮפ§©Ò¥H¬O¤å¦rÀÉ®×,
¦b©ó¨ä©w¸q¤¤¦³ÄÄ©ú :
¤å¦r¤å¥ó¥i¥H¥]§t "¯Â¤å¦r"¡A³z¹L¦b¤å¦r¤å¥ó³Ì«á¤@¦æ«á©ñ¸mÀÉ®×µ²§ô¼Ð»x¨Ó«ü©úÀɮתºµ²§ô¡C
¦b¨ä¤¤°£¤F  ´«¦æ LF (0x0D) »P ªð­º CR(0x0A) ¦r¤¸¥H¥~,
¥þ³¡³£¬O "¥iµø¦r¤¸".
¦Ó "¤G¶i¨îÀÉ®×" ¤¤¨Ã«D¥u¦³¥iµø¦r¤¸.

¦^¨ì­ì¥DÃD :
¦b Excel ¤¤­Y·Q¥H Open binary «ü¥O¨Ó«Ø¥ß "¤G¶i¨î" ÀÉ®×,(·í¯Â¥u¬O·Q¦s©ñ Ascii ½X¬° 0 ~ 255 ªº¦r¤¸¸ê®Æ,¦Ó¼È¤£½×¨ä®æ¦¡)
¥¿½Tªº¨Ï¥Î¤è¦¡¬°¦ó?

¥t chr() ¨ç¼Æ¬O§_¯uªº¥u¯à²£¥Í ascii ½X¬° 128 ¥H¤Uªº¦r¤¸©O?
­Y¯u¬O¦p¦¹, ¨º¨ä»¡©ú¤¤©Ò¿×ªº :
"charcode ªº¥¿±`½d³ò¬° 0-255" ¤Î "charcode ¤Þ¼Æ¬O¤@­Ó¥Î¨ÓÃѧO¬Y¦r¤¸ªº Long"
¤S¦³¦ó·N¸q©O?
ª½±µ§i¶D§Ú­Ì¨ä½d³ò¬° 0 - 127 »P ¨ä®æ¦¡¬° Byte ¤£´N¨¬°÷¤F¶Ü?

TOP

        ÀR«ä¦Û¦b : §g¤l¥ß«í§Ó¡A¤p¤H«í¥ß§Ó¡C
ªð¦^¦Cªí ¤W¤@¥DÃD