Article View: pl.comp.lang.c
Article #308593Re: Opcje fopen
From: AK
Date: Sun, 22 May 2016 17:17
Date: Sun, 22 May 2016 17:17
28 lines
1787 bytes
1787 bytes
Użytkownik "Borneq" <borneq@antyspam.hidden.pl> napisał:
> nie musi to być czyste ANSI C, ale aby działało zarówno w Linuxie (docelowo) jak i pod Windows (do
> testów).
Ehh.. Mlodziezy Mlodziezy.. :(
#include <stdio.h>
char buffer[] = "xyz";
int main()
{
FILE* f;
f = fopen("z.txt", "rb+");
fseek(f, 10, SEEK_SET);
fwrite(buffer, sizeof(buffer[0]), sizeof(buffer), f);
fflush(f);
chsize(fileno(f), ftell(f) - 1);
fclose(f);
return 0;
}
PS: chsize jest (o ile pamietam) Posixowa, ale na Windows tez jest (zarowno mingw jak i VC - Borland
chyba tez).
PS1: Nie pytac mnie wiecej prosze, bo z C zerwalem na dobre (noo. prawie..) 4 lata temu.
AK
Technical Details
Message-ID:
<nhspiv$2mt$1@node1.news.atman.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!.POSTED!not-for-mailReferences:
<nhpa0p$hiu$1@node1.news.atman.pl> <57403116$0$9698$426a74cc@news.free.fr> <nhpcfo$giu$1@node2.news.atman.pl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!.POSTED!not-for-mail From: "AK" <nobody@nowhere.com> Newsgroups: pl.comp.lang.c Subject: Re: Opcje fopen Date: Sun, 22 May 2016 19:17:02 +0200 Organization: ATMAN - ATM S.A. Lines: 29 Message-ID: <nhspiv$2mt$1@node1.news.atman.pl> References: <nhpa0p$hiu$1@node1.news.atman.pl> <57403116$0$9698$426a74cc@news.free.fr> <nhpcfo$giu$1@node2.news.atman.pl> NNTP-Posting-Host: ip-79-175-227-44.cable.smsnet.pl Mime-Version: 1.0 X-Trace: node1.news.atman.pl 1463937439 2781 79.175.227.44 (22 May 2016 17:17:19 GMT) X-Complaints-To: usenet@atman.pl NNTP-Posting-Date: Sun, 22 May 2016 17:17:19 +0000 (UTC) In-Reply-To: <nhpcfo$giu$1@node2.news.atman.pl> X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Windows Mail 6.0.6002.18197 X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6002.18463 X-Antivirus: avast! (VPS 160522-0, 2016-05-22), Outbound message X-Antivirus-Status: Clean Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit