LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 01-20-2004, 03:51 AM   #1
chuanyung
LQ Newbie
 
Registered: Jan 2004
Posts: 25

Rep: Reputation: 15
Question large file support compiler with other tools!?


Dear all,

To handle large file, the I/O functions off_t type should be 64 bit.
I define 2 macros.
They are _LARGEFILE_SOURCE and _FILE_OFFSET_BITS=64.
I use g++ to compiler, it work fine.
But when I use Kylix to compile, there is an error.
Because the type "__quad_t" is a struct. it can't cast a long(/long) int.
The g++ typedef __quad_t long long int. (please reference bits/types.h)
If I use off64_t, kylix still can't cast.

If I define a macro __GNUC__ ,
there are other erros appeared in some header file.

How should I do then can get __quad_t is a long long int?
Please help, thanks.

my code:
--------------------------------------
#define _LARGEFILE_SOURCE
#define _FILE_OFFSET_BITS 64
#include <stdio.h>
#include <fcntl.h>
#include <limits.h>

int main(int argc, char* argv[])
{

int fd=open("/tmp/test.txt",O_RDONLY);
if (fd<0) {
return -1;
}
void *buf;
double i=0;

//using off_t mm=lseek(fd,off_t(ULONG_MAX),SEEK_SET);no used too.
off_t mm=lseek(fd,ULONG_MAX,SEEK_SET);
while (read(fd,buf,10)>0) {
printf("%s at offset %f\n",(char*)buf,ULONG_MAX+(++i)*10);
}
close(fd);
printf("Finish...............\n");
cin.get();
return 0;
}
-----------------------------------------------------
The compiler error:
E2034 Cannot convert 'unsigned long' to '__quad_t'
E2342 Type mismatch in parameter '__offset'(wanted '__quad_t,got
'unsigned long')
-----------------------------------------------------
Regards,
cylin.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Where can I get info about Large File Support on woody? MrinCodex Debian 3 05-19-2005 12:01 PM
Large file size support for linux merlin23 Linux - Newbie 11 01-11-2005 08:01 AM
How to enable large file support (LFS)? maddmike Suse/Novell 0 12-27-2004 10:45 AM
Large File Support on a 32-bit machine JapanMtlExpat Linux - Software 3 11-26-2004 02:50 AM
File does not exist/Large file support dreamtheater Linux - General 3 04-19-2004 09:14 AM


All times are GMT -5. The time now is 04:40 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration