Jump to content
php.lv forumi

rakstishana failaa


Raiviic

Recommended Posts

nezinu kaa shitadu sameklet tapec jautaaju - ja kads zin var iedot ari man linku - jautajums sekojosh - ja tiek rakstits faila tad rakstaas pec kaartas attieciigi :

1

2

3

4

 

man vajadzetu lai tas viss rakstas taa :

4

3

2

1

 

attieicigi nevis beigas pedejam bet pirms peedeejaa, varbut kads var kautkaa izliidzet? ieprieksh jau paldies

Link to comment
Share on other sites

http://lv.php.net/fopen

http://lv.php.net/fwrite vai fputs viens un tas pats .....

 

fopen($filename,'x+');

'x+' Create and open for reading and writing; place the file pointer at the beginning of the file. If the file already exists, the fopen() call will fail by returning FALSE and generating an error of level E_WARNING. If the file does not exist, attempt to create it. This is equivalent to specifying O_EXCL|O_CREAT flags for the underlying open(2) system call. This option is supported in PHP 4.3.2 and later, and only works for local files.

 

tulkosim.. lietojot "x+" priekš atvēršanas, mēs atveram read+write modē un noliekam kursoru sākumā

lietojot "x" priekš atvēršanas, mēs atveram write modē un noliekam kursoru sākumā

Edited by [Ya]
Link to comment
Share on other sites

ja atver failu ar fopen("file", "r+"); tad pointers ir saakuma...

 

fopen("file", "r+") fwrite ieraksta 1

fopen("file", "r+") fwrite ieraksta 2

fopen("file", "r+") fwrite ieraksta 3

fopen("file", "r+") fwrite ieraksta 4

 

beigas vajadzetu iznakt ka ierakstits ir

4

3

2

1

 

:)

Link to comment
Share on other sites

es to domu biju uztaisijis pats diezgan sen.. kad nomainiju hdd tad padirsu savus suuri gruuti ceptos skriptus un pasutiju dirst php.. reali izbesija. bet tagad pamazam censhos iejusties php aarees.

 

nu man doma bij taada:

 

1. nolasa failu kuram pievienos, piem. baaze.txt

2. saturu pieskir kaukadam mainigajam .. $baaze

3. izdzess faila baaze.txt saturu

4. ieraksta jauno informaaciju

5. pievieno atpakalj $baaze

i viss straadaa kaa smeereets..

 

palasot paaris funkcijas shito var viegli uztaisit, neznu, bet ganjau var ari vienkarsak, bet man sen aizmirsies par funkcijaam kas te vaidzigas.

Edited by vladimirs
Link to comment
Share on other sites

×
×
  • Create New...