[問題] 讀取複雜的文字檔
假如有一個檔案,內容摘錄如下:
---
pin(Y) {
direction : output;
capacitance : 0.0;
...
timing() {
related_pin : "A";
cell_rise(delay_template_7x7) {
index_1 ("0.1, 0.3, 0.5, 1.2, 2, 3.5, 5.1");
index_2 ("0.0012, 0.06, 0.12, 0.3, 0.54, 0.78, 1.02");
values ( \
"0.160560, 0.361777, 0.554405, 1.129650, 1.895607, 2.661473, 3.427275", \
"0.194078, 0.394502, 0.587044, 1.162409, 1.928577, 2.694489, 3.460319", \
"0.213038, 0.415019, 0.607252, 1.182489, 1.948657, 2.714585, 3.480426", \
"0.240248, 0.444941, 0.637123, 1.212236, 1.978116, 2.743964, 3.509774", \
"0.239647, 0.450504, 0.642963, 1.217908, 1.983599, 2.749230, 3.514933", \
"0.201920, 0.423800, 0.620239, 1.198460, 1.964499, 2.730255, 3.495705", \
"0.136574, 0.368609, 0.568776, 1.156107, 1.924668, 2.690540, 3.456458");
}
...
}
...
}
---
類似這樣很複雜的檔案,
要把裡面的內容讀到一個已經設計好的 structure 裡面,
這......就是在寫一個 parser 了嗎?
除了燃燒自己的肝自己用手慢慢刻之外,
有沒有其他比較簡便、有效率的方法去讀取嗎?
有請各位前輩指教了 <(_ _)>
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.160.97.198
推
02/10 11:26, , 1F
02/10 11:26, 1F
推
02/10 12:02, , 2F
02/10 12:02, 2F
→
02/10 12:03, , 3F
02/10 12:03, 3F
→
02/10 12:04, , 4F
02/10 12:04, 4F
→
02/10 14:06, , 5F
02/10 14:06, 5F
→
02/10 14:06, , 6F
02/10 14:06, 6F
→
02/10 19:29, , 7F
02/10 19:29, 7F
→
02/10 19:30, , 8F
02/10 19:30, 8F
→
02/10 21:04, , 9F
02/10 21:04, 9F
→
02/10 21:05, , 10F
02/10 21:05, 10F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章