- 論壇徽章:
- 22
|
回復 9# rubyish
我將你的代碼放入腳本后執行后
返回信息了- // gcc -Wall -O3 -march=native -o biru biru.c `pkg-config --cflags --libs glib-2.0`
- // ./biru b a > c
- # include <stdio.h>
- # include <ctype.h>
- # include <string.h>
- # include <stdlib.h>
- # include <glib.h>
- # define LINE 512
- # define KEY 256
- # define insert g_hash_table_insert
- # define contains g_hash_table_contains
- # define Table g_hash_table_new_full
- # define destroy g_hash_table_destroy
- # define STR g_str_hash, g_str_equal
- # define FREE F_, F_
- # define print(s) fputs (s, stdout)
- typedef char *str;
- typedef char kar;
- typedef unsigned Int;
- void alkaa (str);
- void fari (str);
- GHashTable *hash = NULL;
- int main (int para, str *vec){
- fari (vec[1]);
- alkaa (vec[2]);
- destroy (hash);
- return 0;
- } /* main */
- /* ______________________ SUB ______________________ */
- void F_ (gpointer data) {
- free (data);
- }
- void fari (str fil){
- FILE *lima = fopen (fil, "r");
- hash = Table (STR, FREE);
- kar garis[LINE] = { 0 };
- while (fgets (garis, LINE, lima)) {
- garis[strlen (garis) - 1] = 0;
- insert (hash, strdup (garis), NULL);
- }
- }
- void alkaa (str fil){
- FILE *lima = fopen (fil, "r");
- kar garis[LINE] = { 0 };
- kar kunci[KEY] = { 0 };
- while (fgets (garis, LINE, lima)) {
- kar *dat = garis;
- Int aantal = 0;
- while (*dat) {
- if (!isalnum (*dat)) {
- dat++;
- continue;
- }
- str formaat = isdigit (*dat) ? "%[0-9]%n" : "%[a-zA-Z]%n";
- sscanf (dat, formaat, kunci, &aantal);
-
- if (contains (hash, kunci)) {
- print (garis);
- break;
- }
-
- dat += aantal;
- }
- }
- } /* dos */
復制代碼
$ ./biru b.txt a.txt > c
./biru: line 1: pkg-config: command not found
./biru: line 1: //: Is a directory
./biru: line 2: //: Is a directory
./biru: line 21: typedef: command not found
./biru: line 22: typedef: command not found
./biru: line 23: typedef: command not found
./biru: line 25: syntax error near unexpected token `('
./biru: line 25: `void alkaa (str);'
|
|