Annotation of coherent/a/usr/man/MULTI/lseek, revision 1.1.1.1

1.1       root        1: 
                      2: 
                      3: lseek()                COHERENT System Call               lseek()
                      4: 
                      5: 
                      6: 
                      7: 
                      8: Set read/write position
                      9: 
                     10: lloonngg llsseeeekk(_f_d, _w_h_e_r_e, _h_o_w)
                     11: iinntt _f_d, _h_o_w; lloonngg _w_h_e_r_e;
                     12: 
                     13: llsseeeekk changes the _s_e_e_k _p_o_s_i_t_i_o_n, or the point within a file where
                     14: the next read or write  operation is performed.  fd is the file's
                     15: file descriptor, which is returned by ooppeenn.
                     16: 
                     17: where and  how describe the  new seek position.   where gives the
                     18: number of  bytes that you wish  to move the seek  position; it is
                     19: measured from the beginning of the  file if how is zero, from the
                     20: current seek position if how is  one, or from the end of the file
                     21: if how is  two.  A successful call to lseek  returns the new seek
                     22: position.  For example,
                     23: 
                     24: 
                     25:         position = lseek(filename, 100L, 0);
                     26: 
                     27: 
                     28: moves the seek position 100 bytes past the beginning of the file;
                     29: whereas
                     30: 
                     31: 
                     32:         position = lseek(filename, 0L, 1);
                     33: 
                     34: 
                     35: merely returns the current seek position, and does not change the
                     36: seek position at all.
                     37: 
                     38: Sparse files may be created by seeking beyond the current size of
                     39: the file  and writing.  The ``hole'' between the  end of the file
                     40: and where  the write occurs  is read as  zero and will  occupy no
                     41: disk space.  For example, if you llsseeeekk 10,000 bytes past the cur-
                     42: rent end  of file and  write a string,  the data will  be written
                     43: 10,000 bytes past the old  end of file and all intervening matter
                     44: will be considered part of the file.
                     45: 
                     46: lseek differs  from its  cousin fseek in  that lseek is  a system
                     47: call and  uses a file  descriptor, whereas fseek is  a C function
                     48: and uses a FILE pointer.
                     49: 
                     50: ***** See Also *****
                     51: 
                     52: COHERENT system calls, STDIO
                     53: 
                     54: ***** Diagnostics *****
                     55: 
                     56: lseek  returns -1L  on an  error, such as  seeking to  a negative
                     57: position.  If no error occurs, it returns the new seek position.
                     58: 
                     59: ***** Notes *****
                     60: 
                     61: llsseeeekk is permitted on character-special files, but drivers do not
                     62: 
                     63: 
                     64: COHERENT Lexicon                                           Page 1
                     65: 
                     66: 
                     67: 
                     68: 
                     69: lseek()                COHERENT System Call               lseek()
                     70: 
                     71: 
                     72: 
                     73: generally implement it.  As a result, seeking a terminal will not
                     74: generate an error but will have no discernible effect.
                     75: 
                     76: 
                     77: 
                     78: 
                     79: 
                     80: 
                     81: 
                     82: 
                     83: 
                     84: 
                     85: 
                     86: 
                     87: 
                     88: 
                     89: 
                     90: 
                     91: 
                     92: 
                     93: 
                     94: 
                     95: 
                     96: 
                     97: 
                     98: 
                     99: 
                    100: 
                    101: 
                    102: 
                    103: 
                    104: 
                    105: 
                    106: 
                    107: 
                    108: 
                    109: 
                    110: 
                    111: 
                    112: 
                    113: 
                    114: 
                    115: 
                    116: 
                    117: 
                    118: 
                    119: 
                    120: 
                    121: 
                    122: 
                    123: 
                    124: 
                    125: 
                    126: 
                    127: 
                    128: 
                    129: 
                    130: COHERENT Lexicon                                           Page 2
                    131: 
                    132: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.