Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

sunilkumarg

macrumors newbie
Original poster
Apr 11, 2012
8
0
Hi I have 64bit application which compare two files.This application support upto 2 GB FILE only , But i want support large file (20 GB File).
But Iam getting Error "file cant open"while using application
Running application on 64bit MAC machine.
I think so.In 64 bit machine We can support upto 2^64 size.

Plase help me

Thanks in advance
Sunny
 
Last edited by a moderator:
You should be able to open the file regardless of size, reading it all into memory is another issue though. Can you post the code where you are opening the file.
 
Last edited by a moderator:
Hi I have 64bit application which compare two files.This application support upto 2 GB FILE only , But i want support large file (20 GB File).
But Iam getting Error "file cant open"while using application
Running application on 64bit MAC machine.
I think so.In 64 bit machine We can support upto 2^64 size.

Plase help me

Thanks in advance
Sunny

You've given us a lot of useful information to diagnose the problem. :mad: So I'd say the answer is that you made a mistake somewhere and you need to read the documentation.

Alternatively, try to think about what we might need to actually help you.
 
Last edited by a moderator:
A few possibilities come to mind:
  1. Your application is not actually compiled 64-bit. You can check this in the terminal using the "file" command, e.g. "file a.out" If this is the case, you can recompile it and pass -m64, e.g. "gcc -m64 foo.c"
  2. If you're using the fopen() call, it should set errno. You can use perror() and friends to check that. Look at the perror man page.
 
Last edited:
You've given us a lot of useful information to diagnose the problem. :mad: So I'd say the answer is that you made a mistake somewhere and you need to read the documentation.

Alternatively, try to think about what we might need to actually help you.

Hi,

We have API's in windows
_ftelli64() ;
_fseeki64();
on Linux
lseek64();
ltell64();

For doing 64 bit file opeartion like this do we have any API's on MAC for doing 64 bit file operation.

Best and regards
Sunny
 
Hi,

We have API's in windows
_ftelli64() ;
_fseeki64();
on Linux
lseek64();
ltell64();

For doing 64 bit file opeartion like this do we have any API's on MAC for doing 64 bit file operation.

Best and regards
Sunny

Look at the fseek, ftell man pages, pick the version with off_t arguments (The fseeko() and ftello() functions conform to IEEE Std 1003.1-2001 (``POSIX.1'')). OS X conforms to posix and unix03 unlike Linux. This still has nothing to do with your problem of opening the file..

Still, you can use fseek and ftell since a long on LP64 systems (all unixes, not windows) are 8 bytes. It's signed so you maximum file size has to be below 2^63, i.e waaaayy beyond your needs.
 
Last edited:
Look at the fseek, ftell man pages, pick the version with off_t arguments (The fseeko() and ftello() functions conform to IEEE Std 1003.1-2001 (``POSIX.1'')). OS X conforms to posix and unix03 unlike Linux. This still has nothing to do with your problem of opening the file..

Still, you can use fseek and ftell since a long on LP64 systems (all unixes, not windows) are 8 bytes. It's signed so you maximum file size has to be below 2^63, i.e waaaayy beyond your needs.

Thanks for support

iam able to open smaller size file but large file iam not able to open

check this code small code

fp1 = fopen(argv[1],"rb");
fp2 = fopen(argv[2],"rb");


if ((fp1 == NULL) && (fp1 == NULL))
{
printf("File can't be opened : %s\n", argv[2]);
printf("File can't be opened : %s\n", argv[1]);
fprintf(outfp,"%s,%s,%s\n",argv[1],argv[2],"NO FILES TO COMPARE");
abort_flag= 1;
}
 
Thanks for support

iam able to open smaller size file but large file iam not able to open

check this code small code

fp1 = fopen(argv[1],"rb");
fp2 = fopen(argv[2],"rb");


if ((fp1 == NULL) && (fp1 == NULL))
{
printf("File can't be opened : %s\n", argv[2]);
printf("File can't be opened : %s\n", argv[1]);
fprintf(outfp,"%s,%s,%s\n",argv[1],argv[2],"NO FILES TO COMPARE");
abort_flag= 1;
}

If you are not able to open larger files it's coincidental, you should take the advice from above and use perror, which will tell you the reason why you could not open the files.

Code:
if( (fp = fopen(argv[1], "rb")) == NULL ) {
    perror(argv[1]);
    return errno;
}

if( (fp2 = fopen(argv[2], "rb")) == NULL ) {
    perror(argv[2]);
    return errno;
}

(include errno.h btw)
 
For doing 64 bit file opeartion like this do we have any API's on MAC for doing 64 bit file operation.

MAC is the abbreviation for "Media Access Control". Every Mac has a MAC address which uniquely identifies the computer, so does just about every PC. What you are talking about is a Mac.

And the answer is "Yes". When you go into terminal and enter "man ftell", what functions other than ftell does it mention? So which one are you going to use? What parameter types do these functions have? Which ones will work with huge files on a 64 bit system, and which ones will work both on 32 bit and 64 bit systems?

This is just exhausting. Does nobody teach you guys how to use a computer to actually find out things? Do you have no curiosity at all to learn things on your own? I could tell you which one to use, but this is just too stupid.

BTW. I recommend turning on the spelling checker in Safari.
 
Last edited:
MAC is the abbreviation for "Media Access Control". Every Mac has a MAC address which uniquely identifies the computer, so does just about every PC. What you are talking about is a Mac.

And the answer is "Yes". When you go into terminal and enter "man ftell", what functions other than ftell does it mention? So which one are you going to use? What parameter types do these functions have? Which ones will work with huge files on a 64 bit system, and which ones will work both on 32 bit and 64 bit systems?

This is just exhausting. Does nobody teach you guys how to use a computer to actually find out things? Do you have no curiosity at all to learn things on your own? I could tell you which one to use, but this is just too stupid.

BTW. I recommend turning on the spelling checker in Safari.

Hey what u mean ???What u r trying say :)
 
If you are not able to open larger files it's coincidental, you should take the advice from above and use perror, which will tell you the reason why you could not open the files.

Code:
if( (fp = fopen(argv[1], "rb")) == NULL ) {
    perror(argv[1]);
    return errno;
}

if( (fp2 = fopen(argv[2], "rb")) == NULL ) {
    perror(argv[2]);
    return errno;
}

(include errno.h btw)
Iam able to open large file and able to compare files

Thanks guys
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.