전체 글 725

이진 파일을 읽어서 16진수로 보여주는 HexView 소스 with Haskell

Haskell 언어 소스: {- Filename: testHexView_02.hs Purpose: Show hexadecimal values of the given file. Compile: ghc testHexView_02.hs Execute: testHexView_02 [filename] Date: 2013. 8. 20. -} module Main where import System.Directory import System.Exit import System.IO import System.Environment import Text.Printf import Data.Bits import Data.Char (ord) import Data.Char (chr) import Data.Array import D..

이진 파일을 읽어서 16진수로 보여주는 HexView 소스 with Scala

Scala 언어 소스: /* * Filename: testHexView_03.scala * * Purpose: Show the hexadecimal values of the given file. * * Compile: scalac -deprecation -d . testHexView_03.scala * Execute: scala testHexView_03 [filename] * * Date: 2013. 8. 18. */ import java.io._ object testHexView_03 { def printUsage() { println("Usage: scala testHexView_03 [filename]") } def toHex(n: Int) : String = { var s = "" var x1 ..

이진 파일을 읽어서 16진수로 보여주는 HexView 소스 with F#

F# 언어 소스: (* Filename: testHexView_02.fs * * Compile: fsc testHexView_02.fs * Execute: testHexView_02 [filename] * * Date: 2013. 8. 18. *) open System open System.IO let Value (c:char) = (int c) - (int 'A') + 1 let toHex n = let mutable s = "" let x1 = (n &&& 0xF0) >>> 4 let x2 = n &&& 0xF if x1 > 24 let x3 = (n &&& 0xF00000) >>> 20 let x4 = (n &&& 0xF0000) >>> 16 let x5 = (n &&& 0x..

프로그래밍/F# 2013.08.18

이진 파일을 읽어서 16진수로 보여주는 HexView 소스 with Octave

Octave 언어 소스: % Filename: testHexView_02.m % % Execute: octave -qf testHexView_02.m [filename] % % Date: 2013. 8. 18. function printUsage() printf("Usage: octave -qf testHexView_02.m [filename]\n"); endfunction function y = getFileSize(fd) n = ftell(fd); fseek(fd, 0, SEEK_END); x = ftell(fd); fseek(fd, n, SEEK_SET); y = x; endfunction function y = toHex(n) s = ""; x1 = bitshift(bitand(n, 0xF0), ..

이진 파일을 읽어서 16진수로 보여주는 HexView 소스 with Boo

Boo 언어 소스: # Filename: testHexView_02.boo # # Execute: booi testHexView_02.boo [filename] # # Or # # Compile: booc testHexView_02.boo # Execute: testHexView_02 [filename] # # Date: 2013. 8. 16. import System import System.IO def printUsage(): print "Usage: booi testHexView_02 [filename]" def isDirectory(path as string) as bool: fa = System.IO.File.GetAttributes(path) isDir = false if (fa & FileA..

프로그래밍/Boo 2013.08.16

이진 파일을 읽어서 16진수로 보여주는 HexView 소스 with Visual BASIC

Visual BASIC 언어 소스: REM ============================================================================ REM Filename: TestHexView_03.vb REM REM Compile: vbc TestHexView_03.vb REM Execute: TestHexView_03 [filename] REM REM Date: 2013. 8. 6. REM ============================================================================ Imports System.IO Public Class HexViewUtil Shared Sub PrintUsage() Console.Write..

이진 파일을 읽어서 16진수로 보여주는 HexView 소스 with PHP

PHP 언어 소스: 실행 예 1> php testHexView_02.php temp_1.bin The size of the file "temp_1.bin" is 12. 0000 0000: 48 65 6C 6C 6F 20 74 68 65 72 65 0A |Hello there. | Read 12 bytes. 실행 예 2> php testHexView_02.php myFile.ser The size of the file "myFile.ser" is 130. 0000 0000: AC ED 00 05 73 72 00 06 50 65 72 73 6F 6E 07 31 |....sr..Person.1| 0000 0010: 46 DB A5 1D 44 AB 02 00 03 49 00 03 61 67 65 4C |F.....

프로그래밍/PHP 2013.08.06

이진 파일을 읽어서 16진수로 보여주는 HexView 소스 with Julia

Julia 언어 소스: ## Filename: testHexView_02.jl ## ## Purpose: Show the hexadecimal codes of the given binary file. ## ## Set Env: set path=d:\julia;%path% ## Execute: julia testHexView_02.jl [filename] ## ## Date: 2013. 8. 4. function printUsage() @printf("Using: julia testHexView_02.jl [filename]\n") end function toHex(b) s = "" x1 = (b & 0xF0) >> 4 x2 = b & 0x0F if x1 > 9 s = s * char(int('A') + ..

이진 파일을 읽어서 16진수로 보여주는 HexView 소스 with Go

Go 언어 소스: /* * Filename: testHexView_02.go * * Purpose: Show Hexadecimal codes of the given binary file. * * Execute: go run testHexView_02.go [filename] * * or * * Compile: go build testHexView_02.go * Execute: ./testHexView_02.go [filename] * * Date: 2013. 8. 3. */ package main import ( "fmt" "os" ) func print(str string) { fmt.Printf("%s", str); } func println(str string) { fmt.Printf("%s\n",..

프로그래밍/Go 2013.08.05