dio_seek

(PHP 4 >= 4.2.0, PECL)

dio_seek -- Seeks to pos on fd from whence

Description

int dio_seek ( resource fd, int pos [, int whence] )

The function dio_seek() is used to change the file position of the file with descriptor fd. The parameter whence specifies how the position pos should be interpreted:

  • SEEK_SET (default) - specifies that pos is specified from the beginning of the file.

  • SEEK_CUR - Specifies that pos is a count of characters from the current file position. This count may be positive or negative.

  • SEEK_END - Specifies that pos is a count of characters from the end of the file. A negative count specifies a position within the current extent of the file; a positive count specifies a position past the current end. If you set the position past the current end, and actually write data, you will extend the file with zeros up to that position.

Przykład 1. Setting the baud rate on a serial port

<?php

$fd
= dio_open('/dev/ttyS0', O_RDWR);

dio_seek($fd, SEEK_SET, 10);
// position is now at 10 characters from the start of the file

dio_seek($fd, SEEK_CUR, -2);
// position is now at 8 characters from the start of the file

dio_seek($fd, SEEK_END, 5);
// position is now at 5 characters from the end of the file

dio_seek($fd, SEEK_END, -10);
// position is now at 10 characters past the end of the file.
// The 10 characters between the end of the file and the current
// position are filled with zeros.

dio_close($fd);
?>



Język PHP to dzisiaj powszechnie przyjęty standard, podstawa tworzenia dynamicznych stron WWW, opartych na bazach danych.

PHP to język skryptowy. Znaczy to, że jest to język nie kompilowalny. Program jest wykonywany przez interpreter na podstawie jego kodu źródłowego. Język PHP to element technologii internetowej SERVER-SIDE. Znaczy to, że kod języka jest wykonywany od strony serwera (na serwerze).

W jakim celu używac PHP? Po co to komu?

Załóżmy, że potrzebujemy takiej strony internetowej, która wyświetli zawsze bieżącą datę. Dzięki technologii PHP, datę i godzinę odczytywać można z miejsca gdzie wykonuje się skrypt, np. gdy serwer znajduje się w USA a my w Polsce to widoczna jest różnica w czasie który zostanie wyświetlony.

sprzedaż skuterów biżuteria srebrna Naprawa instalacji gazowych Internet - Szubin W porządku. Na razie Jimmy.powiększanie ust, hurtownia odzieży, agent ubezpieczeniowy, wizy do rosji, Rajdy konne, tłumacz włoskiego, Przeprowadzki Sosnowiec, noclegi nad morzem, Interfejs VAG, Nagrzewnice Poznan