home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a085 / 1.ddi / LOCKDB.PRG < prev    next >
Encoding:
Text File  |  1994-01-12  |  1.3 KB  |  43 lines

  1. *⌐░⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐┤
  2. *⌐ª      Program: LOCKDB.PRG                                           ⌐ª
  3. *⌐ª     Function: ╩╣╙├ LLIO ║»╩²╨▐╕─╩²╛▌┐Γ╡─┐¬═╖╡─╡┌╥╗╕÷╫╓╜┌, ╥╘▒ú╗ñ   ⌐ª
  4. *⌐ª               ╩²╛▌┐Γ╡─╖╢└².                                        ⌐ª
  5. *⌐ª        Usage: =LOCKDB("Database name")                             ⌐ª
  6. *⌐╕⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐ñ⌐╝
  7. FUNCTION lockdb
  8. PARAMETERS file_name
  9. PRIVATE file_name, file_alias, handle, keybyte
  10.  
  11. IF AT(".",file_name) = 0
  12.    * ╚τ╣√├╗╙╨┤½╗╪╩²╛▌┐Γ║≤╫║├√ .DBF ╡─┤ª└φ
  13.    file_alias = file_name
  14.    file_name  = file_name + ".DBF"
  15. ELSE
  16.   file_alias = SUBSTR(file_name,1,AT(".",file_name)-1)
  17. ENDIF
  18.  
  19. IF USED(file_alias)
  20.    WAIT "LOCKDB() ╬▐╖¿╨▐╕─╥╤┤≥┐¬╩²╛▌┐Γ┐¬═╖╡─╡┌╥╗╕÷╫╓╜┌. "+;
  21.           "╟δ╣╪▒╒╩²╛▌┐Γ " + upper(file_alias) + " ║≤╘┘╩╘ ! " WINDOW
  22.   RETURN(.F.)
  23. ENDIF
  24.  
  25. handle = FOPEN(file_name,2)
  26.  
  27. IF handle = -1
  28.   = WRONG("LOCKDB() ╬▐╖¿│╔╣ª╡╪┤≥┐¬╩²╛▌┐Γ " + file_alias +;
  29.           ".  ▒╛║»╩²╓┤╨╨╜½╩º░▄ "+;
  30.   RETURN(.F.)
  31. ENDIF
  32.  
  33. * ╢┴╚í▒φ═╖╡─╡┌╥╗╕÷╫╓╜┌
  34. keybyte = FREAD(handle,1)
  35. * ╜½╬─╝■╓╕╒δ╥╞╗╪╡┌╥╗╕÷╫╓╜┌
  36. = FSEEK(handle,0)
  37. * ╙├▒╚╘¡└┤╕▀┴╜╬╗╡─ ASC II ╫╓╖√╕─╨┤
  38. = FWRITE(handle,CHR(ASC(keybyte)+2))
  39. * ╣╪▒╒╬─╝■
  40. = FCLOSE(handle)
  41.  
  42. RETURN(.T.)
  43.