我已經重寫了一個函數,我需要一個項目來構建媒體數據庫,其中包含媒體本身的信息。 在下面這段代碼中,我試圖從標題長度爲HH:MM:SS的用戶獲取一個字符串。 然後,我必須使用第一個isdigit字符串的指針分割字符數小時,第一個isdigit字符後第一個「:」分鐘和第一個isdigit字符後最後一個「:」檢查字符串是否與我想要的用戶進入。 爲了檢查子字符串是否合法,我使用atoi轉換爲int並嘗試寫入結構,但指針正在烘烤我。 任何幫助表示讚賞。編譯錯誤,成員不是工會的成員|使用指針/結構體
赫雷什代碼本身(用於引擎收錄更好的可讀性)datetime.c with functions to examine string and put pointers on first digit of the input, first digit after first: and first digit after last:
我評論其中編譯錯誤發生(在引擎收錄L.103 105 107)
爲了獲得更好的見解這裏的結構使用im:
datastructure.h everything but char * zeit is required as written
事先我真的感覺THX愚蠢最近試圖迫使它通過試錯來編譯,我不認爲我越來越接近目的地在所有...
編輯:當我嘗試編譯:
||=== Build: Debug in Iue2 (compiler: GNU GCC Compiler) ===|
C:\Users[...]\datetime.c||In function 'convertStringToTime':|
C:\Users[...]\datetime.c|104|error: request for member 'hour' in something not a structure or union|
C:\Users[...]\datetime.c|106|error: request for member 'minute' in something not a structure or union|
C:\Users[...]1\datetime.c|108|error: request for member 'second' in something not a structure or union|
||=== Build failed: 3 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
使用['strtol'](http://en.cppreference.com/w/c/string/byte/strtol),您可以同時進行驗證和轉換。 – 2014-11-23 20:32:00
至於你的問題,*你得到了什麼*錯誤?請*編輯您的問題*以包含完整和未經編輯的錯誤日誌。 – 2014-11-23 20:36:03
已更新。對不起,我認爲將其添加到行,並指出它是好的。 – 2014-11-23 20:40:13