Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

c/vc++ »·¾³Ï²»Í¬µÄÎļþ³¤¶È»ñÈ¡·½·¨

£¨Ò»£©
¶ÔÎļþ²Ù×÷ʱÓÐʱ»ñµÃÎļþµÄ´óСʱ±ØÒªµÄ.ÏÂÃæÊÇ»ñµÃÆä´óССµÄ½Ï¼òµ¥·½·¨.
#include<io.h>   //CÓïÑÔÍ·Îļþ
#include<iostream>   //for system();
using namespace std;
int main()
{
  int handle;
  handle = open("test.txt", 0x0100); //open file for read
  long length = filelength(handle); //get length of file
  cout<<"file length in bytes:"<<length<<endl;
  close(handle);
 
  system("pause");
  return 0;
}
£¨¶þ£©
//ÓÃWindows API ÖÐµÄ GetFileSize()»ñµÃÎļþ³¤¶È
//¼ÙÉèÎļþfile.txt ÔÚµ±Ç°Ä¿Â¼ÏÂ
//file.txtµÄÄÚÈÝΪ:123abc
//¹ØÓÚwindows APIº¯ÊýÇé²Î¿¼²¿·Öwindows APIº¯Êý»òMSDN
#include <iostream>
#include <windows.h>   //for windows api
using namespace std;
int main()
{
  //ÓÃAPIº¯ÊýCreateFile()´´½¨Îļþ¾ä±ú
  HANDLE fhadle = CreateFile("file.txt",           //ÎļþÃû»ò·¾¶
                                  0,
                                  0,
                                  0,
                                  OPEN_EXISTING, //Îļþ´æÔÚÔò´ò¿ª²¢¶ÁÈ¡
                              


Ïà¹ØÎĵµ£º

extern "C"

      ΪʲôÐèҪʹÓÃextern "C"ÄØ£¿C++Ö®¸¸ÔÚÉè¼ÆC++֮ʱ£¬¿¼Âǵ½µ±Ê±ÒѾ­´æÔÚÁË´óÁ¿µÄC´úÂ룬ΪÁËÖ§³ÖÔ­À´µÄC´úÂëºÍÒѾ­Ð´ºÃC¿â£¬ÐèÒªÔÚC++Öо¡¿ÉÄܵÄÖ§³ÖC£¬¶øextern "C"¾ÍÊÇÆäÖеÄÒ»¸ö²ßÂÔ¡£
¡¡¡¡ÊÔÏëÕâÑùµÄÇé¿ö:Ò»¸ö¿âÎļþÒѾ­ÓÃCдºÃÁ˶øÇÒÔËÐеúÜÁ¼ºÃ£¬Õâ¸öʱºòÎÒÃÇÐèҪʹÓÃÕâ¸ö¿âÎļþ£ ......

ASA¾ÖÓòÍøC/S¼Ü¹¹ÅäÖÃ×îÖÕÍêÃÀ³¬Ç¿°æ............


ASA¾ÖÓòÍøC/S¼Ü¹¹ÅäÖÃ×îÖÕÍêÃÀ³¬Ç¿°æ............
¾ßÌåʵÏÖÓÐÁ½ÖÖ£¬ÈçÏ£º
Ò»¡¢·þÎñÆ÷¶Ë°²×°ASA£¬ÒòΪҪʹÓÃASAÖÐ×Ô´øµÄSybase Central¹¤¾ß¡£
·þÎñÆ÷¶Ë¿ªÆô£ºscjview.exe£¨¼´£ºSybase Central£¬×¢Òâ²»ÊÇSybase Central-Sybase Central¡£½çÃæÈçͼ£º£©
1¡¢ÉèÖÃÈçÏ£ºfile£­new£­server
·þÎñÆ÷Ãû×ÖËæ±ãÆð£¨±ãÓÚÕâ¸ö¹¤¾ß ......

¾Ý˵ÊÇÃÀ¹ú×î¡°¹Ö¡±C³ÌÐò´óÈüµÄ»ñ½±³ÌÐò

int main()
{
printf(&unix["\021%six\012\0"], (unix)["have"] + "fun" - 0x60);
}
gcc -S±àÒë³É»ã±à´úÂëÈçÏÂ:
        .file   "test.c"
        .section        .rodata
.LC0:
&nbs ......

cʵÏֵĶÁ´óÎļþ·½·¨£¨Ô´´úÂ룩


static char *file2memory(FILE *file, long *size)
{
  char buffer[1024];
  char *string=NULL;
  char *newstring=NULL;
  long len=0;
  long stringlen=0;
  if(file) {
    while((len = fread(buffer, 1, sizeof(buffer), f ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ