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, //Îļþ´æÔÚÔò´ò¿ª²¢¶ÁÈ¡
Ïà¹ØÎĵµ£º
ÎÊÌâÃèÊö£ºÒ»Ë³ÐòÎļþÖÐÖÁ¶à´æÔÚ10000000¸ö¼Ç¼£¬Ã¿Ìõ¼Ç¼¶¼ÊÇÒ»¸ö7λÕûÊý£¬Çë¶Ô´ËÎļþÖÐÊý¾Ý½øÐÐÅÅÐò¡£
ÒªÇó£º1.³ÌÐò¿ÉʹÓÃÄÚ´æÖ»ÓÐ1MB¡£2.³ÌÐòÔËÐÐʱ¼ä¾¡¿ÉÄܵĶ̡£
²¹³ä˵Ã÷£ºÃ¿¸ö¼Ç¼¶¼ÊÇÒ»¸ö7λÕýÕûÊý£¬²¢ÇÒûÓÐÆäËûµÄ¹ØÁªÊý¾Ý£¬Ã¿¸öÕûÊýÖÁ¶àÖ»ÄܳöÏÖÒ»´Î¡£
ʵÏÖ¸ÙÒª£º
ÔÚÏÖʵÖУ¬Î»Í¼ºÍλÏòÁ¿ºÜ³£¼û£¬ÎÒÃÇ¿ÉÒÔÊ¹Ó ......
ASA¾ÖÓòÍøC/S¼Ü¹¹ÅäÖÃ×îÖÕÍêÃÀ³¬Ç¿°æ............
¾ßÌåʵÏÖÓÐÁ½ÖÖ£¬ÈçÏ£º
Ò»¡¢·þÎñÆ÷¶Ë°²×°ASA£¬ÒòΪҪʹÓÃASAÖÐ×Ô´øµÄSybase Central¹¤¾ß¡£
·þÎñÆ÷¶Ë¿ªÆô£ºscjview.exe£¨¼´£ºSybase Central£¬×¢Òâ²»ÊÇSybase Central-Sybase Central¡£½çÃæÈçͼ£º£©
1¡¢ÉèÖÃÈçÏ£ºfile£new£server
·þÎñÆ÷Ãû×ÖËæ±ãÆð£¨±ãÓÚÕâ¸ö¹¤¾ß ......
ºê
È«´óд, Èç¹û±ØÒª, ÓÃÁ¬×Ö·ûÁ¬½Óµ¥´Ê
#define SIZE_LIMIT 1024
#define CONFIG_DEBUG 1
#define PRODUCT_ID 0x1123
ö¾Ù
µ¥´ÊÊ××Öĸ´óд, ²»ÓÃÁ¬×Ö·û
enum {
KeyNumLock,
KeyShift,
Key1,
KayA
} Key;
......
1¡¢CºÍC++¹»±¿£¬±ÆµÄ³ÌÐòÔ±×Ô¼º×öºÜ¶àÊ¡£
CÆäʵ´ó¼Ò¶¼ÖªµÀ£¬ÊÇÒ»ÃÅÖеͼ¶ÓïÑÔ£¬±£ÁôÁËÖ¸ÕëµÈ»ã±àÌØÕ÷£¬Óëϵͳµ×²ã½áºÏÃÜÇС£C++ÄØ£¬¸ü¶àµÄÏò¸öObject C£¬¼´ÃæÏò¶ÔÏóµÄC¡£µ«ÕâЩ£¬Æäʵ²¢²»Äܹ»ÈóÌÐòÔ±ÏԵúÜÅ£¡£
ÎÒ¸öÈ˵ÄÀí½â£¬Ö®ËùÒÔCºÍC++³ÌÐòÔ±ÏԵúÜÅ££¬ÆäʵÔÒòºÍ´ó¼ÒÏëÏñµÄÕýºÃÏà·´£¬²»ÊÇÒòΪCºÍ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 ......