Article View: pl.comp.lang.c
Article #308596Re: Opcje fopen
From: Borneq
Date: Sun, 22 May 2016 18:05
Date: Sun, 22 May 2016 18:05
30 lines
1668 bytes
1668 bytes
W dniu 22.05.2016 o 19:17, AK pisze:
> chsize(fileno(f), ftell(f) - 1);
void truncatePath(const char *path, uint64_t position)
{
#ifdef _WIN32
LARGE_INTEGER lr;
lr.QuadPart = position;
OFSTRUCT ofstruct;
HANDLE hFile = CreateFileA(path, GENERIC_WRITE, 0, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL);
SetFilePointer(hFile, lr.LowPart, &lr.HighPart, FILE_BEGIN);
SetEndOfFile(hFile);
CloseHandle(hFile);
#else
truncate64(path, position);
#endif
}
zdaje się #include <unistd.h>, podam co u mnie:
#ifdef _WIN32
#include <Windows.h>
#else
#include <sys/statvfs.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <linux/limits.h>
#include <dirent.h>
#endif
Technical Details
Message-ID:
<nhsscr$5u6$1@node1.news.atman.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.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> <nhspiv$2mt$1@node1.news.atman.pl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!.POSTED!not-for-mail From: Borneq <borneq@antyspam.hidden.pl> Newsgroups: pl.comp.lang.c Subject: Re: Opcje fopen Date: Sun, 22 May 2016 20:05:15 +0200 Organization: ATMAN - ATM S.A. Lines: 32 Message-ID: <nhsscr$5u6$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> <nhspiv$2mt$1@node1.news.atman.pl> NNTP-Posting-Host: 91.239.205.105 Mime-Version: 1.0 X-Trace: node1.news.atman.pl 1463940315 6086 91.239.205.105 (22 May 2016 18:05:15 GMT) X-Complaints-To: usenet@atman.pl NNTP-Posting-Date: Sun, 22 May 2016 18:05:15 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 In-Reply-To: <nhspiv$2mt$1@node1.news.atman.pl> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit