Nios II ソフトウェア開発ハンドブック Version 1.2 第4章. HALを使用したプログラムの開発 ver.1.2

Size: px
Start display at page:

Download "Nios II ソフトウェア開発ハンドブック Version 1.2 第4章. HALを使用したプログラムの開発 ver.1.2"

Transcription

1 4. HAL NII HAL Hardware Abstraction Layer HAL API Nios II HAL ANSI C HAL API ANSI C HAL HAL API ANSI C ANSI C HAL HAL printf() scanf() ANSI C I/O HAL API RTOS ANSI C Nios II IDE HAL Nios II IDE HAL Nios II IDE Altera Corporation Preliminary

2 Nios II IDE 4-1 HAL Nios II 4-1. Nios II IDE HAL.c.h.s HAL HAL Nios II IDE Nios II IDE SOPC Builder Nios II.ptf SOPC Builder HAL Nios II IDE 1 HAL HAL Nios II SOPC Builder.ptf 4 2 Altera Corporation Nios II

3 HAL SOPC Builder.ptf Nios II IDE HAL HAL HAL system.h system.h HAL system.h Nios II system.h C system.h? system.h IRQ system.h system.h HAL Nios II IDE system.h Nios II IDE HAL Nios II IDE Altera Corporation Nios II

4 HAL system.h system.h /* * sys_clk_timer configuration * */ #define SYS_CLK_TIMER_NAME "/dev/sys_clk_timer" #define SYS_CLK_TIMER_TYPE "altera_avalon_timer" #define SYS_CLK_TIMER_BASE 0x #define SYS_CLK_TIMER_IRQ 0 #define SYS_CLK_TIMER_ALWAYS_RUN 0 #define SYS_CLK_TIMER_FIXED_PERIOD 0 /* * jtag_uart configuration * */ #define JTAG_UART_NAME "/dev/jtag_uart" #define JTAG_UART_TYPE "altera_avalon_jtag_uart" #define JTAG_UART_BASE 0x #define JTAG_UART_IRQ 1 HAL Nios II ANSI C HAL ANSI C alt_type.h HAL 4 1 HAL 4 1. HAL alt_8 alt_u8 alt_16 alt_u16 alt_32 alt_u Altera Corporation Nios II

5 HAL 4 2 GNU Toolchain 4 2. GNU Toolchain char short long int UNIX HAL API UNIX UNIX Nios II HAL HAL ANSI C stdio.h C UNIX _exit() close() fstat() getpid() gettimeofday() ioctl() isatty() kill() lseek() open() read() sbrk() settimeofday() stat() usleep() wait() write() I/O 4 6 Altera Corporation Nios II

6 10 1 HAL API HAL newlib C I/O fopen() fclose() fread() HAL UNIX I/O HAL UNIX close() fstat() ioctl() isatty() lseek() open() read() stat() write() 10 1 HAL API HAL zip /mount/zipfs() /mount/zipfs()/myfile fopen() zipfs HAL system.h /dev/ SOPC Builder SOPC Builder UART uart1 system.h /dev/uart1 4 6 Altera Corporation Nios II

7 HAL HAL zip rozipfs #include <stdio.h> #include <stddef.h> #include <stdlib.h> #define BUF_SIZE (10) int main(void) FILE* fp; char buffer[buf_size]; fp = fopen ( /mount/rozipfs/test, r ); if (fp == NULL) printf ( Cannot open file.\n ); exit (1); fread (buffer, BUF_SIZE, 1, fp); fclose (fp); return 0; 10 1 HAL API UART Universal Asynchronous Receiver/Transmitter HAL file.h ANSI C HAL stdio.h I/O Altera Corporation Nios II

8 I/O stdin stdoutstderr HAL stdin stdout stderr printf() perror() Nios II IDE Nios II IDE Hello World Nios II IDE stdout Hello World #include <stdio.h> int main () printf ( Hello world! ); return 0; UNIX API unistd.h STDIN_FILENO STDOUT_FILENO STDERR_FILENO stdin stdout stderr stdin stdout stderr uart1 UART UART #include <stdio.h> #include <string.h> int main (void) char* msg = hello world ; FILE* fp; 4 8 Altera Corporation Nios II

9 HAL fp = fopen ( /dev/uart1, w ); if (fp) fprintf(fp, %s,msg); fclose (fp); return 0; C++ HAL C++ C++ API /dev/null /dev/null /dev/null /dev/null I/O HAL C I/O zip I/O /mnt/rozipfs fopen( /mnt/rozipfs/myfile, r ) fopen() fread() file.h C I/O 10 1 HAL API Altera Corporation Nios II

10 HAL Nios II HAL API HAL UNIX gettimeofday() settimeofday() times() HAL API sys/alt_alarm.h sys/alt_timestamp.h 10 1 HAL API HAL HAL Nios II IDE Nios II IDE HAL Nios II HAL 4 10 Altera Corporation Nios II

11 HAL alt_nticks() / alt_ticks_per_second() HAL UNIX gettimeofday() settimeofday() times() times.h HAL alt_alarm_start() int alt_alarm_start (alt_alarm* alarm, alt_u32 nticks, alt_u32 (*callback) (void* context), void* context); callback nticks context callback alarm alt_alarm_start() callback alt_alarm_stop() 6 1 Altera Corporation Nios II

12 1 #include <stddef.h> #include <stdio.h> #include sys/alt_alarm.h #include alt_types.h /* * */ alt_u32 my_alarm_callback (void* context) /* 1 */ return alt_ticks_per_second();... /* alt_alarm */ static alt_alarm alarm;... if (alt_alarm_start (&alarm, alt_ticks_per_second(), my_alarm_callback, NULL) < 0) printf ( No system clock available\n ); HAL HAL HAL 1 alt_timestamp_start() alt_timestamp() Nios II IDE 4 12 Altera Corporation Nios II

13 HAL alt_timestamp_start() alt_timestamp() alt_timestamp_start() alt_timestamp_freq() Nios II alt_timestamp.h #include <stdio.h> #include sys/alt_timestamp.h #include alt_types.h int main (void) alt_u32 time1; alt_u32 time2; alt_u32 time3; if (alt_timestamp_start() < 0) printf ( No timestamp device available\n ); else time1 = alt_timestamp(); func1(); /* */ time2 = alt_timestamp(); func1(); /* 2 */ time3 = alt_timestamp(); printf ( time in func1 = %u ticks\n, (unsigned int) (time2 time1)); printf ( time in func2 = %u ticks\n, (unsigned int) (time3 time2)); printf ( Number of ticks per second = %u\n, (unsigned int)alt_timestamp_freq()); return 0; Altera Corporation Nios II

14 HAL HAL API HAL API HAL API EPCS HAL API HAL API 2 API API API sys/alt_flash.h 10 1 HAL API 4 14 Altera Corporation Nios II

15 HAL alt_flash_open_dev() alt_write_flash() alt_read_flash() alt_flash_close_dev() 4 16 API 1 alt_flash_open_dev() system.h alt_write_flash() int alt_write_flash(alt_flash_fd* fd, int offset, const void* src_addr, int length ) fd offset src_addr length alt_read_flash() int alt_read_flash( alt_flash_fd* fd, int offset, void* dest_addr, int length ) fd offset dest_addr length alt_read_flash() alt_flash_close_dev() void alt_flash_close_dev(alt_flash_fd* fd ) Altera Corporation Nios II

16 system.h /dev/ext_flash API API #include <stdio.h> #include <string.h> #include sys/alt_flash.h #define BUF_SIZE1024 int main () alt_flash_fd* fd; int ret_code; char source[buf_size]; char dest[buf_size]; /* 0xAA */ memset(source, 0xa, BUF_SIZE); fd = alt_flash_open_dev( /dev/ext_flash ); if (fd) ret_code = alt_write_flash(fd, 0, source, BUF_SIZE); if (!ret_code) ret_code = alt_read_flash(fd, 0, dest, BUF_SIZE); if (!ret_code) /* * * 0xa * dest */ alt_flash_close_dev(fd); else printf( Can t open flash device\n ); return 0; 4 16 Altera Corporation Nios II

17 HAL alt_write_flash() K 8K 0xAA 5K 0x0000 0xBB2 K 0x1400 t(2) 0xAA 5 K 0xFF2 2 t(3) 0xAA 4 K 0xFF 4 K 2 t(4) 0x K 0xFF 4 3. t(0) t(1) t(2) t(3) t(4) x0000 1?? FF AA AA AA 0x0400 1?? FF AA AA AA 0x0800 1?? FF AA AA AA 0x0C00 1?? FF AA AA AA 0x1000 2?? FF AA FF FF (1) 0x1400 2?? FF FF FF BB 0x1800 2?? FF FF FF BB 0x1C00 2?? FF FF FF FF 4 3 (1) 2 FF Altera Corporation Nios II

18 3 alt_get_flash_info() alt_erase_flash_block() alt_write_flash_block() alt_get_flash_info() int alt_get_flash_info( alt_flash_fd* fd, flash_region** info, int* number_of_regions) number_of_regions info 1 flash_region flash_region sys/alt_flash_types.h typedef typedef struct flash_region int offset;/* */ int region_size;/* */ int number_of_blocks;/* */ int block_size;/* */ flash_region; 4 18 Altera Corporation Nios II

19 HAL alt_get_flash_info() alt_erase_flash() int alt_erase_flash_block( alt_flash_fd* fd, int offset, int length) fd offset length alt_write_flash_block() 1 int alt_write_flash_block( alt_flash_fd* fd, int block_offset, int data_offset, const void *data, int length) fd block_offset data length data_offset API #include <string.h> #include "sys/alt_flash.h" #define BUF_SIZE 100 int main (void) flash_region* regions; alt_flash_fd* fd; int number_of_regions; int ret_code; char write_data[buf_size]; Altera Corporation Nios II

20 DMA /* write_data 0xa */ memset(write_data, 0xA, BUF_SIZE); fd = alt_flash_open_dev(ext_flash_name); if (fd) ret_code = alt_get_flash_info(fd, &regions, &number_of_regions); if (number_of_regions && (regions->offset == 0)) /* 1 */ ret_code = alt_erase_flash_block(fd, regions->offset, regions->block_size); if (ret_code) /* * write_data BUF_SIZE 100 * 1 */ ret_code = alt_write_flash_block( fd, regions->offset, regions->offset+0x100, write_data, BUF_SIZE); return 0; DMA HAL DMA Direct Memory Access HAL DMA DMA 2 HAL Altera Corporation Nios II

21 HAL 4-2 DMA 3 DMA DMA 4-2. DMA 3 1. DMA Recieve Channel 2. DMA 3. DMA DMA DMA API sys/alt_dma.h 10 1 HAL API DMA 7 1 DMA DMA DMA alt_dma_txchan_open() system.h 1 Altera Corporation Nios II

22 DMA DMA dma_0 DMA #include <stddef.h> #include sys/alt_dma.h int main (void) alt_dma_txchan tx; tx = alt_dma_txchan_open ( /dev/dma_0 ); if (tx == NULL) /* */ else /* */ return 0; alt_dma_txchan_send() typedef void (alt_txchan_done)(void* handle); int alt_dma_txchan_send (alt_dma_txchan dma, const void* from, alt_u32 length, alt_txchan_done* done, void* handle); alt_dma_txchan_send()dma length from DMA handle done DMA 2 alt_dma_txchan_space() alt_dma_txchan_ioctl() alt_dma_txchan_space() alt_dma_txchan_ioctl() 4 22 Altera Corporation Nios II

23 HAL DMA DMA DMA DMA alt_dma_rxchan_open() alt_dma_rxchan_prepare() alt_dma_rxchan_prepare() typedef void (alt_rxchan_done)(void* handle, void* data); int alt_dma_rxchan_prepare (alt_dma_rxchan dma, void* data, alt_u32 length, alt_rxchan_done* done, void* handle); dma legthdata DMA handle done DMA 2 alt_dma_rxchan_depth() alt_dma_rxchan_ioctl() alt_dma_rxchan_depth() alt_dma_rxchan_ioctl() DMA main() DMA #include <stdio.h> #include <stddef.h> #include <stdlib.h> #include sys/alt_dma.h #include alt_types.h /* */ volatile int dma_complete = 0; /* */ void dma_done (void* handle, void* data) Altera Corporation Nios II

24 DMA dma_complete = 1; int main (void) alt_u8 buffer[1024]; alt_dma_rxchan rx; /* */ if ((rx = alt_dma_rxchan_open ( /dev/dma_0 )) == NULL) printf ( Error:failed to open device\n ); exit (1); else /* */ if (alt_dma_rxchan_prepare (rx, buffer, 1024, dma_done, NULL) < 0) printf ( Error:failed to post receive request\n ); exit (1); /* */ while (!dma_complete); printf ( Transaction complete\n ); alt_dma_rxchan_close (rx); return 0; DMA DMA DMA DMA #include <stdio.h> #include <stdlib.h> #include "sys/alt_dma.h" #include "system.h" static volatile int rx_done = 0; /* * * */ 4 24 Altera Corporation Nios II

25 HAL static void done (void* handle, void* data) rx_done++; /* * */ int main (int argc, char* argv[], char* envp[]) int rc; alt_dma_txchan txchan; alt_dma_rxchan rxchan; void* tx_data = (void*) 0x901000; /* */ void* rx_buffer = (void*) 0x902000; /* rx */ /* */ if ((txchan = alt_dma_txchan_open("/dev/dma_0")) == NULL) printf ("Failed to open transmit channel\n"); exit (1); /* */ if ((rxchan = alt_dma_rxchan_open("/dev/dma_0")) == NULL) printf ("Failed to open receive channel\n"); exit (1); /* */ if ((rc = alt_dma_txchan_send (txchan, tx_data, 128, NULL, NULL)) < 0) printf ("Failed to post transmit request, reason = %i\n", rc); exit (1); /* */ if ((rc = alt_dma_rxchan_prepare (rxchan, rx_buffer, 128, done, NULL)) < 0) Altera Corporation Nios II

26 printf ("Failed to post read request, reason = %i\n", rc); exit (1); /* */ while (!rx_done); printf ("Transfer successful!\n"); return 0; HAL Nios II HAL nios2-elf-gcc -O3 compiler 2 2 HAL Nios II IDE HAL Use Small Footprint Drivers HAL DALT_USE_SMALL_DRIVERS 4 26 Altera Corporation Nios II

27 HAL 4 4 Nios II 4 4. P. UART JTAG UART LCD IRQ IRQ ALT_MAX_FD Nios II IDE ALT_MAX_FD /dev/null null /dev/null printf() HAL stdin stdout stderr null stdin stdin stdout stderr Nios II IDE Altera Corporation Nios II

28 ANSI C UNIX I/O UNIX I/O ANSI C I/O I/O ANSI C API UNIX I/O API 4 5 UNIX Newlib C ANSI C HAL newlib newlib ANSI C newlib newlib Nios II IDE nios2-elf-gcc -msmallc newlib C Nios II newlib Windows > Altera > Nios II Development Kit > Nios II Documentation 4 28 Altera Corporation Nios II

29 HAL 4 5 newlib C 4 5. newlib C printf() %f %g scanf() FILE * / stdout stderr stdin FILE * stdio.h asprintf() fiprintf() fprintf() iprintf() printf() siprintf() snprintf() sprintf() vasprintf() vfiprintf() vfprintf() vprintf() vsnprintf() vsprintf() fscanf() scanf() sscanf() vfscanf() vscanf() vsscanf() fseek() ftell() fopen() fclose() fdopen() fcloseall() fileno() stdio.h C++ setbuf() setvbuf() setlocale() localeconv() Altera Corporation Nios II

30 Nios II IDE HAL HAL FPGA DALT_NO_CFI_FLASH HAL 4 31 _exit() HAL exit() exit() C I/O atexit() exit() main() exit() _exit() Nios II IDE -Dexit=_exit 4 30 Altera Corporation Nios II

31 HAL HAL C ALT_NO_INSTRUCTION_EMULATION / / / -mno-hw-mul mhw-div main() alt_main() main() alt_main() ANSI C main() main() HAL HAL Nios II HAL 1 Altera Corporation Nios II

32 ANSI C Nios II alt_main() alt_main() stdout printf() HAL Nios II 4 26 HAL Nios II IDE Nios II Nios II IDE HAL HAL bss_start bss_end BSS BSS.rwdata.rodata/RAM 4 37 alt_main() 4 32 Altera Corporation Nios II

33 HAL alt_main() ALT_OS_INIT() OS HAL HAL alt_fd_list_lock semaphore alt_sys_init() Nios II IDE HAL alt_sys_init.c C I/O stdin stdout stderr _do_ctors() C++ C++ main () exit()main() exit() Nios II alt_main.c Nios II IDE alt_main() HAL alt_main() alt_main() void alt_main (void) Altera Corporation Nios II

34 HAL 1 alt_sys_init.c alt_sys_init() 5 1 HAL HAL HAL HAL Nios II IDE system.h on_chip_memory.on_chip_memory Nios II Altera Corporation Nios II

35 HAL 4-3 0x0 SOPC Builder 0x HAL on_chip_ram 0x0.on_chip_ram 0x0 +0x10 sdram.reset.sdram Nios II RAM RAM Altera Corporation Nios II

36 .reset 3.text.rodata.rwdata.text.rodata.rwdata Nios II IDE Nios II IDE C C++ section.on_chip_memory foo.sdram bar() C /* */ int foo attribute ((section (".on_chip_memory"))) = 0; void bar attribute ((section (".sdram"))) (void) foo++;.section on_chip_memory.section.on_chip_memory GNU 4 36 Altera Corporation Nios II

37 HAL.rwdata.rwdata HAL EPCS RAM HAL.text Nios II IDE Altera Flash Programmer _start EPCS.text HAL _reset _reset _start RAM HAL.rwdata.rodata alt_main() alt_load() Altera Corporation Nios II

38 HAL HAL HAL HAL Nios II HAL Nios II HAL HAL HAL <Nios II >/components HAL <Nios II >/components/altera_hal/hal/inc/sys #include <Nios II >/components/altera_hal/hal/inc/ DMA #include sys/alt_dma/h system.h HAL Nios II IDE Newlib ANSI C <Nios II >/bin HAL Nios II IDE Nios II IDE HAL 4 38 Altera Corporation Nios II

Nios II ソフトウェア開発ハンドブック Version 1.2 セクション IV. 付録 

Nios II ソフトウェア開発ハンドブック Version 1.2 セクション IV. 付録  IV. 10 HAL API 11 12 zip Nios II Nios II / 10 2004 12 v1.2 2004 9 v1.1 2004 5 v1.0 11 2004 12 v1.1 2004 5 v1.0 12 2004 5 v1.0 DMA open() alt_dma_txchan_open() ERRNO ALT_DMA_TX_STREAM_ON ALT_DMA_RX_STREAM_ON

More information

Nios II ソフトウェア開発ハンドブック Version 1.2 第5章. HAL用デバイス・ドライバの開発 ver.1.1

Nios II ソフトウェア開発ハンドブック Version 1.2 第5章. HAL用デバイス・ドライバの開発 ver.1.1 5. HAL NII52005-1.1 HAL Hardware Abstraction Layer HAL API Application Programming Interface Nios II 2 HAL HAL API API HAL API HAL API DMA HAL HAL API HAL API ASCII LCD printf() LCD Altera Corporation

More information

Nios II IDE によるソフトウェア開発 - セクション 1

Nios II IDE によるソフトウェア開発 - セクション 1 ALTIMA Corp. Nios II IDE によるソフトウェア 開 発 セクション 1 ver.1.0 2010 年 8 月 ELSENA,Inc. 目 次 1. はじめに... 3 2. HAL を 用 いたプログラミング... 3 2-1. HAL (Hardware Abstraction Layer)... 3 2-2. Nios II IDE プロジェクトの 構 造... 4 2-3.

More information

Quartus II ハンドブック Volume 5、セクションIV. マルチプロセッサの調整

Quartus II ハンドブック  Volume 5、セクションIV. マルチプロセッサの調整 IV. SOPC Builder Nios II 9 Avalon Mutex 10 Avalon Mailbox 9 10 / 9 v5.1.0 2005 5 v5.0.0 Nios II 2004 12 v1.0 10 v5.1.0 2005 5 v5.0.0 Altera Corporation IV 1 Quartus II Volume 5 IV 2 Altera Corporation

More information

1 C STL(1) C C C libc C C C++ STL(Standard Template Library ) libc libc C++ C STL libc STL iostream Algorithm libc STL string vector l

1 C STL(1) C C C libc C C C++ STL(Standard Template Library ) libc libc C++ C STL libc STL iostream Algorithm libc STL string vector l C/C++ 2007 6 18 1 C STL(1) 2 1.1............................................... 2 1.2 stdio................................................ 3 1.3.......................................... 10 2 11 2.1 sizeof......................................

More information

slide4.pptx

slide4.pptx ソフトウェア工学入門 第 4 回ライブラリ関数 ライブラリ関数 stdio stdio : 標準入出力ライブラリ カーネルレベルのストリームに API を追加し インタフェースを提供する カーネル fd read(2) write(2) stdio バッファ BUFSIZ プログラム BUFSIZ ごと 小さい単位 バッファ : 一時的にデータを保存しておく場所のことバッファリング : バッファを経由してデータをやり取りすること

More information

Nios® II HAL API を使用したソフトウェア・サンプル集 「Modular Scatter-Gather DMA Core」

Nios® II HAL API を使用したソフトウェア・サンプル集 「Modular Scatter-Gather DMA Core」 ALTIMA Company, MACNICA, Inc Nios II HAL API Modular Scatter-Gather DMA Core Ver.17.1 2018 8 Rev.1 Nios II HAL API Modular Scatter-Gather DMA Core...3...3...4... 4... 5 3-2-1. msgdma... 6 3-2-2. On-Chip

More information

A/B (2018/10/19) Ver kurino/2018/soft/soft.html A/B

A/B (2018/10/19) Ver kurino/2018/soft/soft.html A/B A/B (2018/10/19) Ver. 1.0 kurino@math.cst.nihon-u.ac.jp http://edu-gw2.math.cst.nihon-u.ac.jp/ kurino/2018/soft/soft.html 2018 10 19 A/B 1 2018 10 19 2 1 1 1.1 OHP.................................... 1

More information

: CR (0x0d) LF (0x0a) line separator CR Mac LF UNIX CR+LF MS-DOS WINDOWS Japan Advanced Institute of Science and Technology

: CR (0x0d) LF (0x0a) line separator CR Mac LF UNIX CR+LF MS-DOS WINDOWS Japan Advanced Institute of Science and Technology I117 8 1 School of Information Science, Japan Advanced Institute of Science and Technology : CR (0x0d) LF (0x0a) line separator CR Mac LF UNIX CR+LF MS-DOS WINDOWS Japan Advanced Institute of Science and

More information

Nios II ソフトウェア開発ハンドブック Version 1.2 第6章. 例外処理 ver.1.2

Nios II ソフトウェア開発ハンドブック Version 1.2 第6章. 例外処理 ver.1.2 6. NII52006-1.2 Nios II ISR HAL Hardware Abstraction Layer Nios II HAL ISR ISR HAL API Application Programming Interface ISR ISR C ISR ISR ISR Nios II Nios II Nios II Nios II RISC 1 1 Nios II Altera Corporation

More information

ARM gcc Kunihiko IMAI 2009 1 11 ARM gcc 1 2 2 2 3 3 4 3 4.1................................. 3 4.2............................................ 4 4.3........................................

More information

‚æ4›ñ

‚æ4›ñ ( ) ( ) ( ) A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9 (OUS) 9 26 1 / 28 ( ) ( ) ( ) A B C D Z a b c d z 0 1 2 9 (OUS) 9

More information

mstrcpy char *mstrcpy(const char *src); mstrcpy malloc (main free ) stdio.h fgets char *fgets(char *s, int size, FILE *stream); s size ( )

mstrcpy char *mstrcpy(const char *src); mstrcpy malloc (main free ) stdio.h fgets char *fgets(char *s, int size, FILE *stream); s size ( ) 2008 3 10 1 mstrcpy char *mstrcpy(const char *src); mstrcpy malloc (main free ) stdio.h fgets char *fgets(char *s, int size, FILE *stream); s size ( ) stream FILE ( man ) 40 ( ) %./a.out String : test

More information

joho07-1.ppt

joho07-1.ppt 0xbffffc5c 0xbffffc60 xxxxxxxx xxxxxxxx 00001010 00000000 00000000 00000000 01100011 00000000 00000000 00000000 xxxxxxxx x y 2 func1 func2 double func1(double y) { y = y + 5.0; return y; } double func2(double*

More information

1.ppt

1.ppt /* * Program name: hello.c */ #include int main() { printf( hello, world\n ); return 0; /* * Program name: Hello.java */ import java.io.*; class Hello { public static void main(string[] arg)

More information

ファイル入出力と プロセス間通信 \(1\)

ファイル入出力と プロセス間通信 \(1\) ファイル入出力と プロセス間通信 (1) 2004 年 12 月 10 日 海谷治彦 1 目次 まずはマニュアルをみよう. 2 章システムコールインタフェース 3 章汎用関数定義 アンバッファー化入出力 (Unbuffered I/O) open, read, write... lseek, dup... 標準入出力ライブラリ fopen, fscanf, fprintf... 標準入力, 標準出力,

More information

卒 業 研 究 報 告.PDF

卒 業 研 究 報 告.PDF C 13 2 9 1 1-1. 1-2. 2 2-1. 2-2. 2-3. 2-4. 3 3-1. 3-2. 3-3. 3-4. 3-5. 3-5-1. 3-5-2. 3-6. 3-6-1. 3-6-2. 4 5 6 7-1 - 1 1 1-1. 1-2. ++ Lisp Pascal Java Purl HTML Windows - 2-2 2 2-1. 1972 D.M. (Dennis M Ritchie)

More information

ex14.dvi

ex14.dvi 1,, 0, b (b b 2 b ) n k n = n j b j, (0 n j b 1), n =(n k n k 1...n 1 n 0 ) b, n j j j +1, 0,...,b 1 (digit). b b, n b 1 ñ, ñ = k (b 1 n j )b j b N, n b n, n = b N n, n =ñ+1 b N, n m n + m (mod b N ),

More information

II ( ) prog8-1.c s1542h017%./prog8-1 1 => 35 Hiroshi 2 => 23 Koji 3 => 67 Satoshi 4 => 87 Junko 5 => 64 Ichiro 6 => 89 Mari 7 => 73 D

II ( ) prog8-1.c s1542h017%./prog8-1 1 => 35 Hiroshi 2 => 23 Koji 3 => 67 Satoshi 4 => 87 Junko 5 => 64 Ichiro 6 => 89 Mari 7 => 73 D II 8 2003 11 12 1 6 ( ) prog8-1.c s1542h017%./prog8-1 1 => 35 Hiroshi 2 => 23 Koji 3 => 67 Satoshi 4 => 87 Junko 5 => 64 Ichiro 6 => 89 Mari 7 => 73 Daisuke 8 =>. 73 Daisuke 35 Hiroshi 64 Ichiro 87 Junko

More information

tutorial_lc.dvi

tutorial_lc.dvi 00 Linux v.s. RT Linux v.s. ART-Linux Linux RT-Linux ART-Linux Linux kumagai@emura.mech.tohoku.ac.jp 1 1.1 Linux Yes, No.,. OS., Yes. Linux,.,, Linux., Linux.,, Linux. Linux.,,. Linux,.,, 0..,. RT-Linux

More information

Original : Hello World! (0x0xbfab85e0) Copy : Hello World! (0x0x804a050) fgets mstrcpy malloc mstrcpy (main ) mstrcpy malloc free fgets stream 1 ( \n

Original : Hello World! (0x0xbfab85e0) Copy : Hello World! (0x0x804a050) fgets mstrcpy malloc mstrcpy (main ) mstrcpy malloc free fgets stream 1 ( \n 2008 3 10 1 mstrcpy char *mstrcpy(const char *src); mstrcpy malloc (main free ) stdio.h fgets char *fgets(char *s, int size, FILE *stream); s size ( ) stream FILE ( man ) 40 ( ) %./a.out String : test

More information

スライド タイトルなし

スライド タイトルなし ファイル入出力 (2) これまでのおさらい ( 入出力 ) これまでの入出力は 入力 scanf 出力 printf キーボードと画面 ( 端末 ) scanf/printf は 書式つき入出力 フォーマットを指定する 標準入出力を対象とする 何もしなければ 標準入出力は キーボードと画面 ストリームという考え方 ストリーム (stream) = データの列 キーボードから打つ文字列 画面に出力される文字列

More information

1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() 2 double *a[ ]; double 1 malloc() dou

1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() 2 double *a[ ]; double 1 malloc() dou 1 1.1 C 2 1 double a[ ][ ]; 1 3x3 0 1 3x3 ( ) 0.240 0.143 0.339 0.191 0.341 0.477 0.412 0.003 0.921 1.2 malloc() 2 double *a[ ]; double 1 malloc() double 1 malloc() free() 3 #include #include

More information

Nios II IDE によるソフトウェア開発 セクション 2

Nios II IDE によるソフトウェア開発  セクション 2 ALTIMA Corp. Nios II IDE によるソフトウェア開発セクション 2 ver.1.0 2010 年 8 月 ELSENA,Inc. Nios II IDE によるソフトウェア開発セクション 2 目次 1. はじめに... 4 2. Nios II ソフトウェア プロジェクトが必要とする重要なファイル... 4 2-1. HAL システム ヘッダファイル... 4 2-2. リンカ

More information

超初心者用

超初心者用 3 1999 10 13 1. 2. hello.c printf( Hello, world! n ); cc hello.c a.out./a.out Hello, world printf( Hello, world! n ); 2 Hello, world printf n printf 3. ( ) int num; num = 100; num 100 100 num int num num

More information

:30 12:00 I. I VI II. III. IV. a d V. VI

:30 12:00 I. I VI II. III. IV. a d V. VI 2017 2017 08 03 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF X [ S ] a S S ; X X X, S [, a, ], ; BNF X (parse tree) (1) [a;a] (2) [[a]] (3) [a;[a]] (4) [[a];a] : [a] X 2 222222

More information

Nios II ハードウェア・チュートリアル

Nios II ハードウェア・チュートリアル Nios II ver. 7.1 2007 8 1. Nios II FPGA Nios II Quaruts II 7.1 Nios II 7.1 Nios II Cyclone II count_binary 2. 2-1. http://www.altera.com/literature/lit-nio2.jsp 2-2. Nios II Quartus II FEATURE Nios II

More information

I. Backus-Naur BNF : N N 0 N N N N N N 0, 1 BNF N N 0 11 (parse tree) 11 (1) (2) (3) (4) II. 0(0 101)* (

I. Backus-Naur BNF : N N 0 N N N N N N 0, 1 BNF N N 0 11 (parse tree) 11 (1) (2) (3) (4) II. 0(0 101)* ( 2016 2016 07 28 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF : 11011 N N 0 N N 11 1001 N N N N 0, 1 BNF N N 0 11 (parse tree) 11 (1) 1100100 (2) 1111011 (3) 1110010 (4) 1001011

More information

I. Backus-Naur BNF S + S S * S S x S +, *, x BNF S (parse tree) : * x + x x S * S x + S S S x x (1) * x x * x (2) * + x x x (3) + x * x + x x (4) * *

I. Backus-Naur BNF S + S S * S S x S +, *, x BNF S (parse tree) : * x + x x S * S x + S S S x x (1) * x x * x (2) * + x x x (3) + x * x + x x (4) * * 2015 2015 07 30 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF S + S S * S S x S +, *, x BNF S (parse tree) : * x + x x S * S x + S S S x x (1) * x x * x (2) * + x x x (3) +

More information

1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() malloc 2 #include <stdio.h> #include

1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() malloc 2 #include <stdio.h> #include 1 1.1 C 2 1 double a[ ][ ]; 1 3x3 0 1 3x3 ( ) 0.240 0.143 0.339 0.191 0.341 0.477 0.412 0.003 0.921 1.2 malloc() malloc 2 #include #include #include enum LENGTH = 10 ; int

More information

/* do-while */ #include <stdio.h> #include <math.h> int main(void) double val1, val2, arith_mean, geo_mean; printf( \n ); do printf( ); scanf( %lf, &v

/* do-while */ #include <stdio.h> #include <math.h> int main(void) double val1, val2, arith_mean, geo_mean; printf( \n ); do printf( ); scanf( %lf, &v 1 http://www7.bpe.es.osaka-u.ac.jp/~kota/classes/jse.html kota@fbs.osaka-u.ac.jp /* do-while */ #include #include int main(void) double val1, val2, arith_mean, geo_mean; printf( \n );

More information

FreeBSD 1

FreeBSD 1 FreeBSD 1 UNIX OS 1 ( ) open, close, read, write, ioctl (cdevsw) OS DMA 2 (8 ) (24 ) 256 open/close/read/write Ioctl 3 2 2 I/O I/O CPU 4 open/close/read/write open, read, write open/close read/write /dev

More information

プロセッサ・アーキテクチャ

プロセッサ・アーキテクチャ 2. NII51002-8.0.0 Nios II Nios II Nios II 2-3 2-4 2-4 2-6 2-7 2-9 I/O 2-18 JTAG Nios II ISA ISA Nios II Nios II Nios II 2 1 Nios II Altera Corporation 2 1 2 1. Nios II Nios II Processor Core JTAG interface

More information

r08.dvi

r08.dvi 19 8 ( ) 019.4.0 1 1.1 (linked list) ( ) next ( 1) (head) (tail) ( ) top head tail head data next 1: NULL nil ( ) NULL ( NULL ) ( 1 ) (double linked list ) ( ) 1 next 1 prev 1 head cur tail head cur prev

More information

ohp08.dvi

ohp08.dvi 19 8 ( ) 2019.4.20 1 (linked list) ( ) next ( 1) (head) (tail) ( ) top head tail head data next 1: 2 (2) NULL nil ( ) NULL ( NULL ) ( 1 ) (double linked list ) ( 2) 3 (3) head cur tail head cur prev data

More information

double float

double float 2015 3 13 1 2 2 3 2.1.......................... 3 2.2............................. 3 3 4 3.1............................... 4 3.2 double float......................... 5 3.3 main.......................

More information

Microsoft PowerPoint - kougi9.ppt

Microsoft PowerPoint - kougi9.ppt C プログラミング演習 第 9 回ポインタとリンクドリストデータ構造 1 今まで説明してきた変数 #include "stdafx.h" #include int _tmain(int argc, _TCHAR* argv[]) { double x; double y; char buf[256]; int i; double start_x; double step_x; FILE*

More information

Microsoft Word - C.....u.K...doc

Microsoft Word - C.....u.K...doc C uwêííôöðöõ Ð C ÔÖÐÖÕ ÐÊÉÌÊ C ÔÖÐÖÕÊ C ÔÖÐÖÕÊ Ç Ê Æ ~ if eíè ~ for ÒÑÒ ÌÆÊÉÉÊ ~ switch ÉeÍÈ ~ while ÒÑÒ ÊÍÍÔÖÐÖÕÊ ~ 1 C ÔÖÐÖÕ ÐÊÉÌÊ uê~ ÏÒÏÑ Ð ÓÏÖ CUI Ô ÑÊ ÏÒÏÑ ÔÖÐÖÕÎ d ÈÍÉÇÊ ÆÒ Ö ÒÐÑÒ ÊÔÎÏÖÎ d ÉÇÍÊ

More information

main main Makefile Makefile C.5 Makefile Makefile Makefile A Mech (TA ) 1. Web (http://www.jsk.t.u-tokyo.ac.jp/ iku

main main Makefile Makefile C.5 Makefile Makefile Makefile A Mech (TA ) 1. Web (http://www.jsk.t.u-tokyo.ac.jp/ iku 2008 (mizuuchi@i.u-tokyo.ac.jp) http://www.jsk.t.u-tokyo.ac.jp/ http://www.jsk.t.u-tokyo.ac.jp/ ikuo/enshu/keisanki/ 2008 5 19 6 24 1 2 2.1 my_sound.c, my_sounc.h, play.c, record.c 2 2. 2.2 2.2.1 main

More information

lexex.dvi

lexex.dvi (2018, c ) http://istksckwanseiacjp/ ishiura/cpl/ 4 41 1 mini-c lexc,, 2 testlexc, lexc mini-c 1 ( ) mini-c ( ) (int, char, if, else, while, return 6 ) ( ) (+, -, *, /, %, &, =, ==,!=, >, >=,

More information

計算機プログラミング

計算機プログラミング プログラミング言語 C 第 8 講 システム標準関数 ( 入出力関数 ) システム標準関数 システムに備え付けの関数 例 ) printf( ); scanf( ); 標準出力関数 標準入力関数 A. 入出力用の関数 高水準入出力関数 高水準言語 (OS に依存しない ) 低水準入出力関数 機械語レベル (OS に依存 ) B. それ以外の関数 引数と関数の型 ( 戻り値 ) に注目しましょう 例

More information

untitled

untitled II yacc 005 : 1, 1 1 1 %{ int lineno=0; 3 int wordno=0; 4 int charno=0; 5 6 %} 7 8 %% 9 [ \t]+ { charno+=strlen(yytext); } 10 "\n" { lineno++; charno++; } 11 [^ \t\n]+ { wordno++; charno+=strlen(yytext);}

More information

Minimum C Minimum C Minimum C BNF T okenseq W hite Any D

Minimum C Minimum C Minimum C BNF T okenseq W hite Any D 6 2019 5 14 6.1 Minimum C....................... 6 1 6.2....................................... 6 7 6.1 Minimum C Minimum C BNF T okenseq W hite Any Digit ::= 0 1 2... 9. Number ::= Digit Digit. Alphabet

More information

para02-2.dvi

para02-2.dvi 2002 2 2002 4 23 : MPI MPI 1 MPI MPI(Message Passing Interface) MPI UNIX Windows Machintosh OS, MPI 2 1 1 2 2.1 1 1 1 1 1 1 Fig. 1 A B C F Fig. 2 A B F Fig. 1 1 1 Fig. 2 2.2 Fig. 3 1 . Fig. 4 Fig. 3 Fig.

More information

新版明解C言語 実践編

新版明解C言語 実践編 2 List - "max.h" a, b max List - max "max.h" #define max(a, b) ((a) > (b)? (a) : (b)) max List -2 List -2 max #include "max.h" int x, y; printf("x"); printf("y"); scanf("%d", &x); scanf("%d", &y); printf("max(x,

More information

I 2 tutimura/ I 2 p.1/??

I 2   tutimura/ I 2 p.1/?? I 2 tutimura@mist.i.u-tokyo.ac.jp http://www.misojiro.t.u-tokyo.ac.jp/ tutimura/ 2002 4 25 I 2 p.1/?? / / Makefile I 2 p.2/?? Makefile make GNU make I 2 p.3/?? Makefile L A T E X I 2 p.4/?? core (1) gcc,

More information

Apache Web Server 2 Compaq ActiveAnswers Deskpro Compaq Insight Manager Fastart Systempro Systempro/LT ProLiant ROMPaq Qvision SmartStart NetFlex Quic

Apache Web Server 2 Compaq ActiveAnswers Deskpro Compaq Insight Manager Fastart Systempro Systempro/LT ProLiant ROMPaq Qvision SmartStart NetFlex Quic Technical Guide 1999 5 Internet and E-Commerce Solutions Business Unit Enterprise Solutions Division Apache Web Server Compaq Linux Apache HTTP Compaq Computer Corporation...3...3...4...5...6...7...7...7...8...10...10...16...16

More information

新・明解C言語 実践編

新・明解C言語 実践編 第 1 章 見 21 1-1 見えないエラー 見 List 1-1 "max2x1.h" a, b max2 List 1-1 chap01/max2x1.h max2 "max2x1.h" #define max2(a, b) ((a) > (b)? (a) : (b)) max2 List 1-2 List 1-2 chap01/max2x1test.c max2 #include

More information

memo

memo 数理情報工学演習第一 C プログラミング演習 ( 第 5 回 ) 2015/05/11 DEPARTMENT OF MATHEMATICAL INFORMATICS 1 今日の内容 : プロトタイプ宣言 ヘッダーファイル, プログラムの分割 課題 : 疎行列 2 プロトタイプ宣言 3 C 言語では, 関数や変数は使用する前 ( ソースの上のほう ) に定義されている必要がある. double sub(int

More information

1 $ cat aboutipa 2 IPA is a Japanese quasi-government 3 organization established in accor- 4 dance with The Law for Information 5 Processing Technolog

1 $ cat aboutipa 2 IPA is a Japanese quasi-government 3 organization established in accor- 4 dance with The Law for Information 5 Processing Technolog 1 $ cat aboutipa 2 IPA is a Japanese quasi-government 3 organization established in accor- 4 dance with The Law for Information 5 Processing Technology Promotion, 6 (Law No.90, May 22, 1979). 7 $./upper

More information

Microsoft PowerPoint - CproNt11.ppt [互換モード]

Microsoft PowerPoint - CproNt11.ppt [互換モード] 第 11 章入出力関数とライブラリ関数 CPro:11-01 概要 getchar putchar gets puts scanf printf strcat strcmp strcpy strlen atoi atof sprint sscanf 11.1 コンソール入出力関数 11-02 入力 出力 getchar putchar 一文字 gets puts 文字列 ( 一行 ) scanf printf

More information

C B

C B C 095707B 2010 6 8 1 LEVE1 2 1.1 LEVEL 1.1................................................ 2 1.1.1 1................................................ 2 1.1.2 1.2..............................................

More information

tuat2.dvi

tuat2.dvi ( 2 ) http://ist.ksc.kwansei.ac.jp/ tutimura/ 2012 7 7 ( 2 ) 1 / 54 (1) (2) (?) (1) (2) 2 ( 2 ) 2 / 54 1. 30 2. 2012 6 30 25 OS ( 2 ) 3 / 54 10 20 1993 1996 2000 2003 = 30 ( 2 ) 4 / 54 1 2 2 ( 2 ) 5 /

More information

PC Windows 95, Windows 98, Windows NT, Windows 2000, MS-DOS, UNIX CPU

PC Windows 95, Windows 98, Windows NT, Windows 2000, MS-DOS, UNIX CPU 1. 1.1. 1.2. 1 PC Windows 95, Windows 98, Windows NT, Windows 2000, MS-DOS, UNIX CPU 2. 2.1. 2 1 2 C a b N: PC BC c 3C ac b 3 4 a F7 b Y c 6 5 a ctrl+f5) 4 2.2. main 2.3. main 2.4. 3 4 5 6 7 printf printf

More information

Nios II 簡易チュートリアル

Nios II 簡易チュートリアル Nios II Ver. 7.1 2007 10 1. Nios II Nios II JTAG UART LED 8 PIO LED < > Quartus II SOPC Builder Nios II Quartus II.sof Nios II IDE Stratix II 2S60 RoHS Nios II Quartus II http://www.altera.com/literature/lit-nio2.jsp

More information

:30 12:00 I. I VI II. III. IV. a d V. VI

:30 12:00 I. I VI II. III. IV. a d V. VI 2018 2018 08 02 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF N N y N x N xy yx : yxxyxy N N x, y N (parse tree) (1) yxyyx (2) xyxyxy (3) yxxyxyy (4) yxxxyxxy N y N x N yx

More information

tuat1.dvi

tuat1.dvi ( 1 ) http://ist.ksc.kwansei.ac.jp/ tutimura/ 2012 6 23 ( 1 ) 1 / 58 C ( 1 ) 2 / 58 2008 9 2002 2005 T E X ptetex3, ptexlive pt E X UTF-8 xdvi-jp 3 ( 1 ) 3 / 58 ( 1 ) 4 / 58 C,... ( 1 ) 5 / 58 6/23( )

More information

program.dvi

program.dvi 2001.06.19 1 programming semi ver.1.0 2001.06.19 1 GA SA 2 A 2.1 valuename = value value name = valuename # ; Fig. 1 #-----GA parameter popsize = 200 mutation rate = 0.01 crossover rate = 1.0 generation

More information

Cプログラミング1(再) 第2回

Cプログラミング1(再) 第2回 C プログラミング 1( 再 ) 第 2 回 講義では Cプログラミングの基本を学び演習では やや実践的なプログラミングを通して学ぶ 1 前回のレポートから 前回の宿題 数あてゲーム の説明において 次のように書いていたものがいた : これはコンピュータがランダムに設定した数字を人間が当てるゲームである この説明でどこかおかしなところはないだろうか? 2 コンピュータの用語と日常的な用語の違い 物理において

More information

C

C C 1 2 1.1........................... 2 1.2........................ 2 1.3 make................................................ 3 1.4....................................... 5 1.4.1 strip................................................

More information

Taro-ファイル処理(公開版).jtd

Taro-ファイル処理(公開版).jtd ファイル処理 0. 目次 1. はじめに 2. ファイル内容の表示 3. ファイル内容の複写 3. 1 文字単位 3. 2 行単位 4. 書式付き入出力 5. 文字配列への入出力 6. 課題 6. 1 課題 1 ( ファイル圧縮 復元 ) - 1 - 1. はじめに ファイル処理プログラムの形は次のようになる #include main() { FILE *fp1,*fp2; ファイルポインタの宣言

More information

ディジタル信号処理

ディジタル信号処理 http://www.cfme.chiba-u.jp/~yama// C 言 語 におけるファイル 入 出 力 テキスト バイナリの 取 り 扱 い ( )..[4]% gcc Wall o hoge hoge.c..[5]%./hoge 1 : 1 2 : 2 3 : 3 4 : 0 6..[6]% (! )..[4]% gcc Wall o hoge hoge.c..[5]%!g gcc Wall

More information

slide5.pptx

slide5.pptx ソフトウェア工学入門 第 5 回コマンド作成 1 head コマンド作成 1 早速ですが 次のプログラムを head.c という名前で作成してください #include #include static void do_head(file *f, long nlines); int main(int argc, char *argv[]) { if (argc!=

More information

NI P1200 Release Notes Cover

NI P1200 Release Notes Cover PEX-H2994W Board Support Package Installation on RedHawk Release Notes July 4, 2019 1. はじめに 本書は Concurrent Real Time IncCCRT) の RedHawk 上で動作する インターフェース社製 PEX- H2994W PCI Express ボードサポートパッケージ用リリースノートです

More information

IP L09( Tue) : Time-stamp: Tue 14:52 JST hig TCP/IP. IP,,,. ( ) L09 IP (2017) 1 / 28

IP L09( Tue) : Time-stamp: Tue 14:52 JST hig TCP/IP. IP,,,. ( )   L09 IP (2017) 1 / 28 L09(2017-11-21 Tue) : Time-stamp: 2017-11-21 Tue 14:52 JST hig TCP/IP. IP,,,. http://hig3.net L09 (2017) 1 / 28 9, IP, - L09 (2017) 2 / 28 C (ex. ) 1 TCP/IP 2 3 ( ) ( L09 (2017) 3 / 28 50+5, ( )50+5. (

More information

全体ロードマップ インターネット電話 音の符号化 ( 信号処理 ) 今日 音の録音 再生 ネットワーク ( ソケット ) プログラミング ファイル入出力 インターネットの基礎 C プログラミング基礎

全体ロードマップ インターネット電話 音の符号化 ( 信号処理 ) 今日 音の録音 再生 ネットワーク ( ソケット ) プログラミング ファイル入出力 インターネットの基礎 C プログラミング基礎 ファイル入出力 全体ロードマップ インターネット電話 音の符号化 ( 信号処理 ) 今日 音の録音 再生 ネットワーク ( ソケット ) プログラミング ファイル入出力 インターネットの基礎 C プログラミング基礎 今日のロードマップ 波形として可視化 (gnuplot) 課題 2.13, 2.15 音を自分のプログラムに読み込む (rec + read) 音を作って鳴らす (write + play)

More information

Microsoft PowerPoint - kougi8.ppt

Microsoft PowerPoint - kougi8.ppt C プログラミング演習 第 8 回構造体とレコードデータファイル 1 例題 1. バイナリファイル形式のファイル からのデータ読み込み 次のような名簿ファイル ( バイナリファイル形式 ) を読み込んで, 画面に表示するプログラムを作る name Ken Bill Mike age 20 32 35 address NewYork HongKong Paris 名簿ファイル 2 #include "stdafx.h"

More information

WinHPC ppt

WinHPC ppt MPI.NET C# 2 2009 1 20 MPI.NET MPI.NET C# MPI.NET C# MPI MPI.NET 1 1 MPI.NET C# Hello World MPI.NET.NET Framework.NET C# API C# Microsoft.NET java.net (Visual Basic.NET Visual C++) C# class Helloworld

More information

新・明解C言語 ポインタ完全攻略

新・明解C言語 ポインタ完全攻略 2 1-1 1-1 /* 1-1 */ 1 int n = 100; int *p = &n; printf(" n %d\n", n); /* n int */ printf("*&n %d\n", *&n); /* *&n int */ printf(" p %p\n", p); /* p int * */ printf("&*p %p\n", &*p); /* &*p int * */ printf("sizeof(n)

More information

untitled

untitled C -1 - -2 - concept lecture keywords FILE, fopen, fclose, fscanf, fprintf, EOF, r w a, typedef gifts.dat Yt JZK-3 Jizake tsumeawase 45 BSP-15 Body soap set 3 BT-2 Bath towel set 25 TEA-2 Koutya

More information

[ 1] 1 Hello World!! 1 #include <s t d i o. h> 2 3 int main ( ) { 4 5 p r i n t f ( H e l l o World!! \ n ) ; 6 7 return 0 ; 8 } 1:

[ 1] 1 Hello World!! 1 #include <s t d i o. h> 2 3 int main ( ) { 4 5 p r i n t f ( H e l l o World!! \ n ) ; 6 7 return 0 ; 8 } 1: 005 9 7 1 1.1 1 Hello World!! 5 p r i n t f ( H e l l o World!! \ n ) ; 7 return 0 ; 8 } 1: 1 [ ] Hello World!! from Akita National College of Technology. 1 : 5 p r i n t f ( H e l l o World!! \ n ) ;

More information

C による数値計算法入門 ( 第 2 版 ) 新装版 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます. このサンプルページの内容は, 新装版 1 刷発行時のものです.

C による数値計算法入門 ( 第 2 版 ) 新装版 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます.  このサンプルページの内容は, 新装版 1 刷発行時のものです. C による数値計算法入門 ( 第 2 版 ) 新装版 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます. http://www.morikita.co.jp/books/mid/009383 このサンプルページの内容は, 新装版 1 刷発行時のものです. i 2 22 2 13 ( ) 2 (1) ANSI (2) 2 (3) Web http://www.morikita.co.jp/books/mid/009383

More information

file"a" file"b" fp = fopen("a", "r"); while(fgets(line, BUFSIZ, fp)) {... fclose(fp); fp = fopen("b", "r"); while(fgets(line, BUFSIZ, fp)) {... fclose

filea fileb fp = fopen(a, r); while(fgets(line, BUFSIZ, fp)) {... fclose(fp); fp = fopen(b, r); while(fgets(line, BUFSIZ, fp)) {... fclose I117 9 2 School of Information Science, Japan Advanced Institute of Science and Technology file"a" file"b" fp = fopen("a", "r"); while(fgets(line, BUFSIZ, fp)) {... fclose(fp); fp = fopen("b", "r"); while(fgets(line,

More information

情報処理演習 B8クラス

情報処理演習 B8クラス 予定スケジュール ( 全 15 回 ) 1 1. 終了 プログラミング言語の基礎 2. 終了 演算と型 3. 終了 プログラムの流れの分岐 (if 文,switch 文など ) 4. 終了 プログラムの流れの繰返し (do, while, for 文など ) 5. 終了 中間レポート1 6. 終了 配列 7. 終了 関数 8. 終了 文字列 ( 文字列の配列, 文字列の操作 ) 9. 終了 ポインタ

More information

02: 変数と標準入出力

02: 変数と標準入出力 C プログラミング入門 基幹 7 ( 水 5) 1 10: ファイル入出力 Linux にログインし 以下の講義ページを開いておくこと http://www-it.sci.waseda.ac.jp/teachers/w48369 2/CPR1/ 2016-06-15 今日の内容 2 標準ライブラリ関数によりファイルの出力を行う画像ファイルの生成を例題として 配列の作成を復習する 文字列の扱いを復習する

More information

r07.dvi

r07.dvi 19 7 ( ) 2019.4.20 1 1.1 (data structure ( (dynamic data structure 1 malloc C free C (garbage collection GC C GC(conservative GC 2 1.2 data next p 3 5 7 9 p 3 5 7 9 p 3 5 7 9 1 1: (single linked list 1

More information

void hash1_init(int *array) int i; for (i = 0; i < HASHSIZE; i++) array[i] = EMPTY; /* i EMPTY */ void hash1_insert(int *array, int n) if (n < 0 n >=

void hash1_init(int *array) int i; for (i = 0; i < HASHSIZE; i++) array[i] = EMPTY; /* i EMPTY */ void hash1_insert(int *array, int n) if (n < 0 n >= II 14 2018 7 26 : : proen@mm.ics.saitama-u.ac.jp 14,, 8 2 12:00 1 O(1) n O(n) O(log n) O(1) 32 : 1G int 4 250 M 2.5 int 21 2 0 100 0 100 #include #define HASHSIZE 100 /* */ #define NOTFOUND 0

More information

エラー処理・分割コンパイル・コマンドライン引数

エラー処理・分割コンパイル・コマンドライン引数 L10(2017-12-05 Tue) : Time-stamp: 2017-12-17 Sun 11:59 JST hig. recv/send http://hig3.net ( ) L10 (2017) 1 / 21 IP I swallow.math.ryukoku.ac.jp:13 = 133.83.83.6:13 = : IP ( = ) (well-known ports), :. :,.

More information

ohp07.dvi

ohp07.dvi 19 7 ( ) 2019.4.20 1 (data structure) ( ) (dynamic data structure) 1 malloc C free 1 (static data structure) 2 (2) C (garbage collection GC) C GC(conservative GC) 2 2 conservative GC 3 data next p 3 5

More information

C言語入門

C言語入門 1 C 言語入門 第 7 週 プログラミング言語 Ⅰ( 実習を含む ), 計算機言語 Ⅰ 計算機言語演習 Ⅰ, 情報処理言語 Ⅰ( 実習を含む ) 2 吐き出し法 ( ガウスの消去法 ) のピボッティング 前回の復習 3 連立一次方程式を行列で計算する 吐き出し法 ( ガウスの消去法 ) ステップ 1: 前進消去 ( 上三角行列の作成 ) gaussian_elimination1.c // step1

More information

II 3 yacc (2) 2005 : Yacc 0 ~nakai/ipp2 1 C main main 1 NULL NULL for 2 (a) Yacc 2 (b) 2 3 y

II 3 yacc (2) 2005 : Yacc 0 ~nakai/ipp2 1 C main main 1 NULL NULL for 2 (a) Yacc 2 (b) 2 3 y II 3 yacc (2) 2005 : Yacc 0 ~nakai/ipp2 1 C 1 6 9 1 main main 1 NULL NULL 1 15 23 25 48 26 30 32 36 38 43 45 47 50 52 for 2 (a) 2 2 1 Yacc 2 (b) 2 3 yytext tmp2 ("") tmp2->next->word tmp2 yytext tmp2->next->word

More information

RX600 & RX200シリーズ アプリケーションノート RX用仮想EEPROM

RX600 & RX200シリーズ アプリケーションノート RX用仮想EEPROM R01AN0724JU0170 Rev.1.70 MCU EEPROM RX MCU 1 RX MCU EEPROM VEE VEE API MCU MCU API RX621 RX62N RX62T RX62G RX630 RX631 RX63N RX63T RX210 R01AN0724JU0170 Rev.1.70 Page 1 of 33 1.... 3 1.1... 3 1.2... 3

More information

untitled

untitled Q 8 1 8.1 (C++) C++ cin cout 5 C++ 16 6 p.63 8.3 #include 7 showbase noshowbase showpoint noshowpoint 8.3 uppercase 16 nouppercase 16 setfill(int) setprecision(int) setw(int) setbase(int) dec

More information

: Nonblocking I/O readpartial read EOF Solaris FILE 256 ungetc SEGV errno stdio considered harmful p.

: Nonblocking I/O readpartial read EOF Solaris FILE 256 ungetc SEGV errno stdio considered harmful p. stdio considered harmful akr@m17n.org 2005 06 02 stdio considered harmful p. : Nonblocking I/O readpartial read EOF Solaris FILE 256 ungetc SEGV errno stdio considered harmful p. : stdio stdio Nonblocking

More information

memo

memo 数理情報工学演習第一 C ( 第 12 回 ) 2016/07/11 DEPARTMENT OF MATHEMATICAL INFORMATICS 1 今日の内容 : ファイルの入出力 コマンドライン引数 2 分探索 クイックソート ( ライブラリ ) 文字列検索 2 ファイル操作の手続き : ファイル操作 ファイルからのデータ読み込み ファイルへのデータ書き出し 基本的な手順 読みこむ / 書き出すファイルを開く

More information

CM-3G 周辺モジュール拡張技術文書 MS5607センサ(温度、気圧)

CM-3G 周辺モジュール拡張技術文書 MS5607センサ(温度、気圧) CM-3G 周辺モジュール拡張技術文書 MS5607 センサ ( 温度 気圧 ) ( 第 1 版 ) Copyright (C)2016 株式会社コンピューテックス 目次 1. はじめに... 1 2. MS5607 について... 1 3. 接続図... 1 4. アプリケーション ソース... 2 5. アプリケーションのコンパイル方法... 7 6. アプリケーションの実行... 8 1. はじめに

More information

2004 2005 2 2 1G01P038-0 1 2 1.1.............................. 2 1.2......................... 2 1.3......................... 3 2 4 2.1............................ 4 2.2....................... 4 2.3.......................

More information

02: 変数と標準入出力

02: 変数と標準入出力 C プログラミング入門 基幹 7 ( 水 5) 10: ファイル入出力 Linux にログインし 以下の講義ページを開いておくこと http://www-it.sci.waseda.ac.jp/ teachers/w483692/cpr1/ 2016-06-15 1 標準ライブラリ関数によりファイルの出力を行う 画像ファイルの生成を例題として 配列の作成を復習する 今日の内容 関数を作ってプログラムを構造化する

More information

数値計算

数値計算 プログラム作成から実行まで 数値計算 垣谷公徳 17 号館 3 階電子メール : kimi@ee.ous.ac.jp Source program hello.c printf("hello\n"); コンパイラ Library libc.a 0011_printf000101001 1101_getc00011100011 1011_scanf1110010100 コンパイル Object module

More information

thesis.dvi

thesis.dvi H8 e041220 2009 2 Copyright c 2009 by Kentarou Nagashima c 2009 Kentarou Nagashima All rights reserved , H8.,,,..,.,., AKI-H8/3052LAN. OS. OS H8 Write Turbo. H8 C, Cygwin.,., windows. UDP., (TA7279P).,.

More information

Baud Rate 9600 Parity NONE Number of Data Bits 8 Number of Stop Bits 1 Flow Control NONE 1 RS232C 200mm 2,000mm DIMM ( ) Telescope East/West LX200 * 1

Baud Rate 9600 Parity NONE Number of Data Bits 8 Number of Stop Bits 1 Flow Control NONE 1 RS232C 200mm 2,000mm DIMM ( ) Telescope East/West LX200 * 1 JARE54 LX200ACF 2012/2/18 2012/6/14 1 Abstract 8 LX200-ACF Linux PC meade Auto Align PC Zero Star Alignment Auto Align Zero Star Alignment 1 1 0.3 Zero Star Alignment 1 0.3 Auto Align 2 54 (2012 11 2013

More information

Microsoft Word - 06

Microsoft Word - 06 平成 24 年度講義 アルゴリズムとデータ構造 第 6 回ファイル入出力 担当 : 富井尚志 (tommy@ynu.ac.jp) 第 6 回 ファイル入出力 前回 ( 第 5 回 ) 配列を扱うアルゴリズム (2) とポインタ の復習 集合を扱う 集合の表現, 配列を使った表現, 要素の列 を 集合 にする, 要素, 積, 和, 差 文字列 C 言語における文字列, 文字列を扱うプログラム 計算機の記憶とポインタ

More information

mbed_library_study_meeting_v1.0.key

mbed_library_study_meeting_v1.0.key mbed _mbed 2014 11 7 https://atnd.org/events/57766 version 1.0, 07-Nov.-2014 Tedd OKANO mbed - - 4.0 (^^; 1 mbed TEDD OKANO https://twitter.com/tedd_okano 10 I 2 C http://developer.mbed.org/users/okano/

More information

Microsoft Word - Cプログラミング演習(10)

Microsoft Word - Cプログラミング演習(10) 第 10 回 (6/25) 3. ファイルとその応用 (3) ファイルの更新 シーケンシャルファイルの更新 シーケンシャルファイルでは, 各レコードが可変長で連続して格納されており, その中の特定のレコードを変更することができない そこで一般的には, マスタファイルからデータを取り出し, 更新処理を行ったあとに新マスタファイルに書き込む 注 ) マスタファイル : 主ファイル, 基本ファイルと呼ばれるファイルで内容は比較的固定的であり,

More information

13 I/O

13 I/O 13 I/O 98-0997-3 14 2 7 Linux OS OS OS I/O I/O TS-I/O I/O I/O TS-I/O TS-I/O 3 1 7 2 9 2.1..................... 9 2.2.................. 10 2.3 2...................... 12 2.4 Linux................... 14

More information

1 return main() { main main C 1 戻り値の型 関数名 引数 関数ブロックをあらわす中括弧 main() 関数の定義 int main(void){ printf("hello World!!\n"); return 0; 戻り値 1: main() 2.2 C main

1 return main() { main main C 1 戻り値の型 関数名 引数 関数ブロックをあらわす中括弧 main() 関数の定義 int main(void){ printf(hello World!!\n); return 0; 戻り値 1: main() 2.2 C main C 2007 5 29 C 1 11 2 2.1 main() 1 FORTRAN C main() main main() main() 1 return 1 1 return main() { main main C 1 戻り値の型 関数名 引数 関数ブロックをあらわす中括弧 main() 関数の定義 int main(void){ printf("hello World!!\n"); return

More information

ファイルシステム

ファイルシステム 1 ソフトウェアアークテクチャ 第 2 回ファイルシステム 環境情報学部 萩野達也 オペレーティングシステムの構成要素 2 アプリケーション オペレーティングシステム システムコール処理 ファイルシステム プロセス管理 ネットワーク管理 メモリ管理 ブートストラップ スケジューラー デバイス管理 ハードウェア 3 ファイルとは 情報を外部記憶媒体に記録する単位 データセットとも呼ばれたことがある ファイルの特徴

More information

PowerPoint プレゼンテーション

PowerPoint プレゼンテーション 構造体 (struct) 構造体の宣言 typedef 宣言 配列では 複数のデータをひとまとまりにして操作することが出来る しかし それぞれのデータは同じ型 ( 例えば整数 あるいは浮動小数点数 ) 出なければならない 型の違うデータをひとまとまりにして扱う方法に 構造体がある 構造体 文文文文名前字 ( 文字列字字 ) 字 整数学籍番号 ( 整数 ) 身長 ( 浮動小数点数 ) 文字 配列 3

More information

Taro-リストⅢ(公開版).jtd

Taro-リストⅢ(公開版).jtd リスト Ⅲ 0. 目次 2. 基本的な操作 2. 1 リストから要素の削除 2. 2 リストの複写 2. 3 リストの連結 2. 4 問題 問題 1 問題 2-1 - 2. 基本的な操作 2. 1 リストから要素の削除 まず 一般的な処理を書き つぎに 特別な処理を書く 一般的な処理は 処理 1 : リスト中に 削除するデータを見つけ 削除する場合への対応 特別な処理は 処理 2 : 先頭のデータを削除する場合への対応

More information