以下に示す短いIF/Prologのプログラムは、file_streamから読み込んだデータを行末文字(UNIXではLF)ごとにトークンに分割したリストを生成します(`iffile.pro'を参照のこと)。詳しい内容はレファレンスマニュアルのR-77ページにあるget_until/3述語の項を参照して下さい。:...
移動
次へ 前へ
上へ 最上
参考
IF/Prologからのストリームの使用
新しいストリーム・クラスの定義
ストリームの制御
File_stream定義を試す
定義済みのCストリーム・ルーチン
さらに複雑なユーザ定義のストリーム
イフコンピュータ > IF/Prolog > マニュアル > IF/Prolog V4.1 マニュアル > IF/Prolog Interfaces > IF/PrologからC言語へのインタフェ−ス > IF/Prolog ストリーム ・インタフェース > File_stream定義を試す

File_stream定義を試す

MINERVA superseeded IF/Prolog. Please see http://www.ifcomputer.co.jp/MINERVA for details.

We discontinued to sell IF/Prolog Dec 31. 2003. For current customers, we continue to provide professional support for IF/Prolog until Dec 31, 2008.

以下に示す短いIF/Prologのプログラムは、file_streamから読み込んだデータを行末文字(UNIXではLF)ごとにトークンに分割したリストを生成します(`iffile.pro'を参照のこと)。詳しい内容はレファレンスマニュアルのR-77ページにあるget_until/3述語の項を参照して下さい。:

listfile(Name,L) :- open(log1,file_stream(Name),[input]), readfilelist(log1,L), close(log1).

readfilelist(Stream, [X | L]) :- get_until(Stream, 0'\n', X, T), T \== 0'\z', !, readfilelist(Stream, L). readfilelist(_Stream, []).

?- listfile('test',L).

L = [hello,world]

yes

続く..
IF/Prolog by Siemens
言語
English
Japanese
German
サーバー
USA
Japan
サイトマップ
索引
目次
全体目次
全体索引
印刷向き
imode
PDA
探索
document: http://www.ifcomputer.co.jp/IFProlog/Manuals/v4.1/advanced_feature/c_interface/strint/usefsd/home_jp.html
published 2008/6/30 update 1995/11/6 (c) 1996-2006 IF Computer Japan
IF Computer 〒113-0022 Tel 03-5814-3352 ifcj@ifcomputer.co.jp
Customer Support 東京都文京区千駄木5-28-2   http://www.ifcomputer.co.jp
冒頭へ managed with ubiCMS