Binary files

20 views
Skip to first unread message

Ehsan Haghshenas

unread,
Jan 16, 2010, 11:13:27 AM1/16/10
to iut_c
Salam. haletoon khoobe??? omidvaram khoob bashid...

ba tavajjoh be soalate doostan, tasmim gereftam ke yekam dar morede
file haye binary tozih bedam...
bebinid bacheha file text yek filei hast ke etela'at ro be soorate
code haye ASCII character be character tooye khodesh zakhire mikone...
ya'eni adade 65500 dar yek file text 5 byte faza ro eshghal mikone...
ama dar file haye binary etela'at be soorate byte byte zakhire
mishan... ya'eni adade 65500 dar file binary 2 byte faza migire...
be onvane mesal file yek file .cpp ro tooye notepad baz konid...
kamelan mitoonid oono bekhoonid... ama inbar file .exe barnamatoon ro
ba notepad baz konid... mibinid ke nemitoonid bekhoonidesh...
(albateh inke tooye yek file binary neveshteh besheh ya text bastegi
be code shoma dareh... be inke shoma az che tabe'i baraye neveshtan
estefadeh kardid, fprintf() ya fwrite() )
albateh ye seri tafavote Dge ham ba ham daran ke aslan niaz nist shoma
bedoonid (mesle nahveye zakhire shodane NewLine ya EndOfFile)
tooye in taklif rooye binary boodan ta'ekid kardam chon mikhastam
befahmid ke bayad ba fread() va fwrite() kar konid.
ya'eni baraye khoondane in.txt az fread() va baraye neveshtane out.txt
az fwrite() estefadeh konid.
hamin... hich niazi Dge'i ham binary ro bendazin door...
dar vaghe'e tanha hadafe shoma ine ke betoonin etela'ate file in.txt
ro be barnamatoon biarin... (ya'eni bekhoonin... hamoon fread() )
hala berid sa'ey konid va soalati ro ke baratoon pish miad beporsid...
chon ye seri nokte dare...

bye.

Reply all
Reply to author
Forward
0 new messages