File Structure - PowerPoint PPT Presentation

About This Presentation
Title:

File Structure

Description:

Title: ( ) Author: admin Last modified by: Abdollah Created Date: 6/18/2006 3:22:55 AM – PowerPoint PPT presentation

Number of Views:50
Avg rating:3.0/5.0
Slides: 23
Provided by: Admin171
Category:
Tags: file | structure

less

Transcript and Presenter's Notes

Title: File Structure


1
?????? ???? ?? (????? ? ???????
???????)???? ????? ? ?????? ???? ????
?????????? ????3
2
??? ???
  • ?????? ?? ????? ? ?????? ?????? ???? ??

3
??? ????
  • ????? ??????? ???? ?? ????? ?????? ??????? ??
    ????? ???? ???? ???? ??? ?? ?????? ???????? ????
    ????? ?? ???.

4
????? ???? ?? ????? ?????? ????
  • ???? ??????? ????? ?? ???? ??
  • ????? ????? ????
  • ??? ??????? ?? ?? ??? ????? ???

5
File Structure
?????? ???? ?????? ?? ???? ????? ???? ?? ?? ????
?? ? ?????? ???? ???? ??????? ?? ???? ?? ???.
?????? ???? ?? ?????? ??????? ??? ????? ?? ?? ???
?? ???? ?? ?? ?????? ??????? ? ????? ???.
6
??????? ?????? ?????? ????? ?????? ????
  • ??????? ?????? (???? ?? ?? ??? ????)
  • ???? ?????? AVL
  • ???? B? ???? B????? ???? B ? ???? ??????
  • ??????? ??????(???? ????)

7
???? ???? ?? ????? ?????? ???? ???? ?????? ?????
??? ?? ???? ????? ??????? ?? ???? ???? ???? ???.
?? ??? ????? ??? ?????? ???? ???? ???? ???? ???
?? ?? ??? ?????? ????? ??????? ?? ???? ? ?? ??
???? ?????? ?????? ???? ??????? ???? ??? ??????
??????? ?? ????? ???.
8
??? ???
  • ?????? ??? ?????? ????

9
??????? ?????? ? ?????
???? ?????? ???? ?????? ?? ?? ?????? ????? ?? ??
?? ???? ?? ???? ?????? ?? ???? ?????? ???? ?????
???. ?? ?????? ?????? ???????? ???? ????? ?????
????. ??????? ?? ??????? ????? ?? ?????? ???
????? ?? ?? ????? ????? ???? ??? ??? ?? ???? ??
????? ???? ???? ????? ????? ?? ???? ?????? ??
???? ??????? ???? ?? ???. ???? ????? ????? ??
?????(?? ?? ????) ??? ?? ?????? ???? ?????? ?
???? ?????? ?? ????? ???.
10
??? ???? ???? ??
  • ????? ???? OPEN
  • FDOPEN(FILENAME,FLAGS,PMODE)
  • FD????? ????? ????.
  • FILENAME?? ???? ???????? ???? ??? ???? ??????.
  • FLAGS?????? ???? OPEN ?? ????? ???? ??????? ??
    ??? ?? ???? ????? ?? ???? ?????? ?? ????? ??? ??
    ??? ?? ???.
  • PMODE???? ?????? ???? ?? ?? ?? ??????.

11
??????? ??? ??????????
????? flags int ????? flags ?? ????? ?? ??? or ???? ??? ?????? ??? ????? ?? ??? .
????? ??? ??????? ?? ?????? ???? O_APEEND
????? ?? ???? ???? ?????O_CREAT
???? ??? ???? ? ???? ????? ???? ????? ?? ??? ?? ?????? .O_CREAT ??? O_ECLE
??? ???? ???? ??? ???? ?????? O_RDONLY
??? ???? ???? ???? ?????? ? ?????O_RDWR
??? ???? ???? ??? ???? ????? O_WRONLY
??? ???? ????? ???? ????? ?? ?? ?? ??? ?? ??? .O_TRUNC
12
???? ???? ??
  • ?????? ?? ?????? ?? ?? ???? ???? ????? ??
    ????,???? ?? ?????? ?? ??? ?????? ???? ?? ????.
  • ?? ????? ????? ?? ????? ???? ?? ???? ??????
    ??? ???? ?????? ?? ??????? ????? ???? ?? ?? ????
    ???? ?????? ? ???? ???? ??? ???? ??? ????? ????
    ??????? ???? ?? ????.

13
?????? ? ?????
  • READ(SOURCE_FILE,DESTINATION_ADDR,SIZE)
  • WRITE(DESTINATION_FILE,SOURCE_ADDR,SIZE)
  • DESTINATION ??? ???? ????
  • SOURCE??? ???? ????
  • SIZE????? ???????? ?? ???? ?????? ?? ????? ???

14
???????? ?????? ?????? ?? ?? ?????? ???? ??
???? ?? ????? ?? ?????.
  • SEEK(SOURCE_FILE,OFFSET)
  • SOURCE_FILE??? ???? ????? ?? ?? ?? ????? ???? ??
    ????
  • OFFSET????? ???? ????? ?? ???? ?? ???? ?? ???

15
????? ?? ????? ??? C
  • POSFSEEK(FILE,BYTE_OFFSET,ORIGIN)
  • POS?? ????? ???? ???? ?? ???? FSEEK ?? ???????
    ?? ??? ?? ????? ?? ?????? ???? ????? ?? ???.
  • FILE????? ????? ????? ?? FSEEK ???? ?? ?? ?????
    ???.
  • BYTE_OFFSET????? ???????? ?? ???? ?? ???? ????
    ???? ???.

16
?????? ????? ??????? ?? ??????? ?? ?????
  • INCLUDEltSTDIO.Hgt
  • Main( )
  • Char ch
  • FILE file
  • Char filename 20
  • Printf (" enter the name of the file") //step 1
  • Gets (filename) //step 2
  • File fopen (filename, "r") //step 3
  • While (fread(ch, 1, 1, file) ! 0) //step 4a
  • Fwrite (ch, 1, 1, student) //step 4b
  • Fclose (file) //step 5

17
?????? ????? ??????? ?? ??????? ? ? ??????? ?????
C
  • include ltfsream.hgt
  • main ( )
  • char ch
  • fstream file
  • char file name 20
  • cout ltlt "enter the name of the file "
    //step 1
  • ltlt flush
  • cin gtgt filename //step 2
  • file . open (filename,iosin)
    //step 3
  • file . unsetf(iosskipws)
  • while (1)
  • file gtgt ch
    //step 4a
  • if (file.fail ()) break
  • cout ltlt ch
    //step 4b
  • file . close ()
    //step 5

18
?????? ????? ?? ?? ??????
  • ????????? ?????? ?? ?????? ????? ???? ?????? ??
    ???.
  • ????? ???? ?????? ?? ?????? ????? ?? ?????????
    ??????????? ???.
  • ???? ???? ?? ??????? / ????? ???? ?? ???.

19
?????? ????? ?? ?? ??????(?????)
  • ??? ?? ??? ???? ?? ????? ?????? ???? ?? ?????
    ????? ??? ?? ?? ???? ???? ?? ??? ?? ???? ?? ??
    ???? ??????? ?? ???? ??? ???? ?? ??????? ???.
  • ?????? ?? ????????? ???? ????? ?????? ???? ?? ???
    ??? ??? ?? ???? ?????? ????? ?? ??? ?? ????? ????
    ?????? ?? ???.

20
????? ?? ?? ????? ?? ?? ??????
BIN
USR
USR6
DEV
BIN
LIB
ADDBCC
KBD
TAPE
YACC
MYDIR
LIB
CONSOLE
LIBS.A
LIBM.A
ADDF
DF
21
????????? ?????? ? ???? ??? ?????
  • ?? ?????? , ???? ???????? ?? ?????? ???
  • ?? ?????? ?????? ? ??? ????? ???? ?? ??? ????
  • ?? ?????? ??? ???? ?? ???? ?? ?? ??? ?? ????
  • ?? ?????? ??? ?????? ???? ??? ???? ???? ????
    ????? ???? ?? ?????? ??? ???.

22
??? ???
  • ????? ????? ? ??? ????? ?????
Write a Comment
User Comments (0)
About PowerShow.com