Home > Back-end >  Empty file overflow problem.
Empty file overflow problem.

Time:11-29

The HTML code is as follows, on the VBox, will overflow error, excuse me how should solve,
# # ifndef _FILE_OFFSET_BITS
# define _FILE_OFFSET_BITS 64
# endif
#include
#include
#include
#include
#include
#include
#include
#include


Int main (int arg c, char * argv [])
{


Int fd=open (" test. TXT ", O_WRONLY | O_TRUNC | O_CREAT, 0777);
If (fd==1)
{
Perror (" open ");
exit(1);
}

Int n=lseek (fd, 4 * 1024 * 1024 * 1024, SEEK_CUR);

Write (fd, "jack", 5);

Close (fd);

exit(0);

}

CodePudding user response:

The Vbox is real mode, access to so much memory,

CodePudding user response:

 4 * 1024 * 1024 * 1024 

This is the space of 4 g, it is suggested that reduced to 4 * 1024 try, there would be no overflow should prompt,
  • Related