전체 글 725

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

Io 언어 소스: /* * Filename: testHexView_03.io * * Purpose: Show Hexadecimal codes of the given binary file. * * Execute: io testHexView_03.io [filename] * * Data: 2013. 8. 3. */ printUsage := method( writeln("Using: io testHexView_02.io [filename]") ) toHex := method(b, s := "" x1 := (b & 0xF0) >> 4 x2 := b & 0x0F if (x1 < 10) then ( s = s .. ((x1 + (("0x" .. "0" asHex) asNumber)) asCharacter) ) el..

프로그래밍/Io 2013.08.05

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

Lua 언어 소스: -- Filename: testHexView_02.lua -- -- Execute: lua testHexView_02.lua [filename] -- -- Date: 2013. 7. 30. -- -- See: http://java.about.com/od/InputOutput/ss/Binary-Stream-Example-Code.htm function printUsage() print "Usage: lua testHexView_02.lua [filename]" end function toHex(b) local bit = require("bit") local s = "" local x1 = bit.rshift(bit.band(b, 0xF0), 4) local x2 = bit.band(b,..

프로그래밍/Lua 2013.08.05

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

Python 언어 소스: # Filename: testHexView_03.py # # Execute: python testHexView_03.py [filename] # Execute: ipy testHexView_03.py [filename] import os import sys def toHex(b): s = "" x1 = (b & 0xF0) >> 4 x2 = b & 0x0F if x1 < 10: s += chr(x1 + ord('0'[0])) else: s += chr((x1 - 10) + ord('A')) if x2 < 10: s += chr(x2 + ord('0')) else: s += chr((x2 - 10) + ord('A')) return s def toHex8(n): s = "" x1 =..

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

C# 언어 소스: // Filename: TestHexView03.cs // // Compile: csc TestHexView03.cs // Execute: TestHexView03 [filename] // // Date: 2013. 7. 31. using System; using System.IO; public class TestHexView03 { public static void PrintUsage() { Console.WriteLine("TestHexView03 [filename]"); } public static String toHex(byte b) { String s = ""; int x1, x2; x1 = (b & 0xF0) >> 4; x2 = b & 0x0F; if (x1 < 10) s +..

프로그래밍/C# 2013.08.05

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

C 언어 소스: // Filename: testHexView_02.c // // Chapter 1. Section 1. // // A basic pattern of C++ Programing // // Compile: gcc -o testHexView_02 testHexView_02.c #include #include #include #include void toHex(char c, char a[3]); void toHex8(int n, char a[10]); int main(int argc, char *argv[]) { char *fname; FILE *file2; fpos_t fsize; long m; int i; char x; char s[3]; char t[10]; char buf[16]; fpo..

프로그래밍/C 2013.08.05

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

C++ 언어 소스: // Filename: testHexView02.cpp // // Chapter 1. Section 1. // // A basic pattern of C++ Programing // // Compile: cl /EHsc testHexView02.cpp // Compile: g++ -std=c++11 -o testHexView02 testHexView02.cpp // Compile: g++ -std=c++0x -o testHexView02 testHexView02.cpp #include #include #include using namespace std; void toHex(char c, char a[3]); void toHex4(int n, char a[5]); void toHex8(..

프로그래밍/C++ 2013.08.05

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

Groovy 언어 소스: // Filename: testHexView_03.groovy // // Execute: groovy testHexView_03.groovy [filename] // // Date: 2013. 7. 28. import java.io.File; import java.io.FileInputStream; import java.io.IOException; public class TestHexView_03 { public static void printUsage() { System.out.println("groovy testHexView_03.groovy [filename]"); } public static String toHex(byte b) { String s = ""; int x1,..

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

Java 언어 소스: // Filename: TestHexView03.java // // Compile: javac TestHexView03.java // Execute: java TestHexView03 [filename] // // Date: 2013. 7. 28. import java.io.File; import java.io.FileInputStream; import java.io.IOException; public class TestHexView03 { public static void printUsage() { System.out.println("java TestHexView03 [filename]"); } public static String toHex(byte b) { String s = ..

C# 언어로 작성하여 실행해 본 OpenGL 예제: Redbook 의 Teapots

컴파일에 필요한 dll 파일들은 CsGL 을 다운로드하면 들어 있다. 이전에 올린 C 언어용 소스와 Python 언어용 소스와 비교하면 이해할 수 있을 것이다. #region BSD License /* BSD License Copyright (c) 2002, Randy Ridge, The CsGL Development Team http://csgl.sourceforge.net/ All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of..

프로그래밍/C# 2013.05.17