From owner-freebsd-questions Tue Jun 30 04:04:12 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id EAA25906 for freebsd-questions-outgoing; Tue, 30 Jun 1998 04:04:12 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from dorifer.heim3.tu-clausthal.de (dorifer.heim3.tu-clausthal.de [139.174.243.252]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id EAA25850 for ; Tue, 30 Jun 1998 04:04:02 -0700 (PDT) (envelope-from olli@dorifer.heim3.tu-clausthal.de) Received: (from olli@localhost) by dorifer.heim3.tu-clausthal.de (8.8.8/8.8.8) id NAA07478 for freebsd-questions@FreeBSD.ORG; Tue, 30 Jun 1998 13:03:54 +0200 (CEST) (envelope-from olli) Date: Tue, 30 Jun 1998 13:03:54 +0200 (CEST) From: Oliver Fromme Message-Id: <199806301103.NAA07478@dorifer.heim3.tu-clausthal.de> To: freebsd-questions@FreeBSD.ORG Subject: Re: Unexpected lseek(2) non-feature Newsgroups: list.freebsd-questions Organization: Administration Heim 3 Reply-To: freebsd-questions@FreeBSD.ORG MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Newsreader: TIN [version 1.2 RZTUC(3) PL2] Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In list.freebsd-questions you wrote (30 Jun 1998 01:40:07 +0200): > Is there some sort of an obscure rule somewhere that says that you cannot > use lseek to pre-extend a file that you have just now opened/created via > a call to open(2) with the O_CREAT option? Use truncate() to pre-extend a file, not lseek(). See the manual page on truncate() for details. Note, however, that it will create a so-called "sparse" file, i.e. it does not contain empty data, but holes. Reading from that area of the file will give zeroes, but there's nothing physically stored on the disk, and no space allocated. If you want this, then you have to write() data to the file (zeroes or whatever). Regards Oliver -- Oliver Fromme, Leibnizstr. 18-61, 38678 Clausthal, Germany (Info: finger userinfo:olli@dorifer.heim3.tu-clausthal.de) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message