The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
command to find out total size of a specific file size (spread over the server) abhinov SUN Solaris 3 08-08-2007 03:48 AM
Exceed Login old_tex HP-UX 0 05-31-2006 08:01 AM
Telnet/Exceed kar1 UNIX for Dummies Questions & Answers 1 03-01-2005 05:09 AM
Exceed aojmoj UNIX for Advanced & Expert Users 2 06-21-2003 11:19 PM
Exceed subsitutions? E-Quality UNIX for Dummies Questions & Answers 1 09-19-2001 07:12 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #8  
Old 02-26-2004
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,616
I don't have 64 bit Sun with a compiler. But again, your compiler has a man page. It will tell you how to use 64 bit mode. Or "man lfcompile" will tell you how to write largefiles while in 32 bit mode. You're going to need to read those man pages and follow the instructions.

The first option, using 64 bit mode is the best. You will probably need nothing more than one more option on the cc command line. The option may be phased "use sparcv9 code" or something like that.
Reply With Quote
Forum Sponsor
  #9  
Old 02-26-2004
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,616
I guess that I can do this on a 32 bit sparc and use the technique in the lfcompile man page. First I need a program:

Code:
#include <stdio.h>
main()
{
        FILE *fp;
        int i;
        fp=fopen("bigfile", "w");
        for(i=1; i<107374190; i++)
                fprintf(fp ,"line num=%09d \n", i);
        exit(0);
}
This will try to make a file that is a few bytes larger than 2GB. After, I run it, "tail bigfile ; sleep 4" will show:

line num=107374180
line num=107374181
line num=107374182
line nu

I need that sleep so my prompt did not overwrite the last line which does not end with a newline character. This is where you are, you have a program that can't write a largefile.


Now that "man lfcompile" page say to use "getconf LFS_CFLAGS" to get the flags I need to compile the program. I see that "getconf LFS_CFLAGS" returns
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
but I will just go with:
/opt/SUNWspro/bin/cc `getconf LFS_CFLAGS` makebigfile.c -o makebigfile
to compile my program. All that matters is that I feed those new options into the compiler one way or another. This really seems rather trivial, but this must be where you were stuck.

Now when I rerun the program, bigfile ends with:
line num=107374186
line num=107374187
line num=107374188
line num=107374189
Reply With Quote
  #10  
Old 02-27-2004
Registered User
 

Join Date: Feb 2002
Posts: 56
I reached more than this size

Source code :

#include <stdio.h>
#define CHUNKSZ 1048576

int main( int argc, char** argv )
{
int imb;
FILE* fp;
char buf[CHUNKSZ];
memset( buf, 0, CHUNKSZ );

if ( argc < 2 )
{ fprintf( stderr, "Usage: %s temp_file_name\n",
argv[0] ); return 1; }

fp = fopen( argv[1], "w" );

for ( imb=0; imb<11000; imb++ )
{
if ( imb % 100 == 0 )
{ fprintf( stderr, "." ); fflush(stderr); }
fwrite( buf, CHUNKSZ, 1, fp );
}

return 0;
}

------------------------------------------------------------


I compiled this source using your way yesteraday ...it reached this value
-rw-r--r-- 1 tabs tabs 1897119744 Feb 27 12:56 omar.txt

I add also -xarch=v9 to generate 64 bit EXE also it reached the same value

-rw-r--r-- 1 tabs tabs 1897119744 Feb 27 12:56 omar.txt


Sorry I discover that the df -k

/dev/dsk/c1t0d0s6 4129290 4088000 0 100% /homes

and my path is mounted on this

Thanks,,,,Yes I will test yours and mine on large partition to resolve this issue .......

I apologize to you....
Reply With Quote
  #11  
Old 02-27-2004
Registered User
 

Join Date: Feb 2002
Posts: 56
Thumbs up Thanks,,,,

It is working .................
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 06:44 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0