Archive for the ‘ Programming ’ Category

스레드 미니사이트

http://www.joinc.co.kr/modules/moniwiki//wiki.php/Site/Thread

네트워크에서 구조체 자체를 넘기는 방법

http://kldp.org/node/59971

fscanf 를 이용한 파일 읽기.

1 #include <stdio.h>
2 #include <string.h>
3
4 typedef struct {
5     char s1[50];
6     char s2[50];
7     char s3[50];
8     char s4[50];
9     char s5[50];
10     char s6[50];
11     char s7[50];
12
13 } conf_value;
14
15 int main(void)
16 {
17     char key[50];
18     char value[50];
19     char temp;
20     FILE *fp = fopen(“parser.conf”, “rt”);
21     int ret;
22
23     while(1)
24     {
25         ret = fscanf(fp, “%s %c %s”, key, &temp, value);
26         if(ret == EOF)
27                 break;
28         printf(“%s %s\n”, key, value);
29     }
30
31     fclose(fp);
32
33     return 0;
34
35 }
~

 

 

fscanf 을 이용해서 파일을 읽어서

원하는 값을 추출한다.