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

090928ÈÕcÓïÑÔѧϰÈռǣ¨ÎļþI/O)

#include<stdio.h>
#include<stdlib.h>
#define MAX 41
static int i=0;
int main(void)
{
FILE *fp;
char words[MAX];
if((fp=fopen("words","a+"))==NULL)
{
fprintf(stdout,"Can't open \" word\" file\n");
exit(1);
}
puts("Enter words to add to the file,press the enter.");
puts("Key at the begining of a line to terminate.");
while(gets(words)!=NULL&&words[0]!='\0')
{
fprintf(fp,"%s",words);
i++;
}
rewind(fp);
while(fscanf(fp,"%s",words)==1)
{
puts(words);
}
if(fclose(fp)!=0)
{
fprintf(stderr,"Error closing file.\n");
}
return 0;
}

#include<stdio.h>
#include<stdlib.h>
#define MAX 2000
int main(void)
{
FILE *fp;
char words[MAX];
int wordct=0;
if((fp=fopen("words","a+"))==NULL)
{
fprintf(stderr,"Can't open \" word\" file\n");
exit(1);
}
rewind(fp);
while (fgets(words, MAX - 1, fp) != NULL)
wordct++;
rewind(fp);
puts("Enter words to add to the file,press the enter.");
puts("Key at the begining of a line to terminate.");
while(gets(words)!=NULL&&words[0]!='\0')
{
fprintf(fp,"%d:%s",++wordct,words);
}
puts("File contents:");
rewind(fp);
while(fgets(words,MAX-1,fp)!=NULL)
{
fputs(words,stdout);
}
if(fclose(fp)!=0)
{
fprintf(stderr,"Error closing file.\n");
}
return 0;
}
/*ÎļþÃûÓÉÓû§ÊäÈ룬½¨Á¢Ò»¸öÑ­»·£¬ÈÃÓû§ÊäÈëÎļþλÖã¬
Ôò´òӡλÖõ½ÏÂÒ»¸ö»»ÐзûÖ®¼äµÄ×Ö·û£¬µ±ÊäÈë·ÇÊý×Ö×Ö·ûʱÍ˳ö*/
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
#define MAX 41
int main(void)
{
FILE *fp;
char ch;
char file[MAX];
long address;
puts("ÇëÊäÈëÎļþÃû");
gets(file);
if((fp=fopen(file,"rb"))==NULL)
{
fprintf(stderr,"Can't open the %s\n",file);
exit(1);
}


printf("ÇëÊäÈëÒ»¸öÎļþλÖÃ\n");
while(1)
{
scanf("%ld",&address);
if(isdigit(address))
{
break;
}
fseek(fp,address,SEEK_SET);

while((ch=getc(fp))!='\n' && (ch=getc(fp)


Ïà¹ØÎĵµ£º

(ת£©Ñ§Ï°c/c++µÄ50¸öºÃÍøÕ¾

1¡¢http://snippets.dzone.com/tag/c/ --ÊýÒÔǧ¼ÆµÄÓÐÓõÄCÓïÑÔÔ´´úÂëƬ¶Î
2¡¢http://www.hotscripts.com/category/c-cpp/scripts-programs/ Hotscripts --ÌṩÊýÒ԰ټƵÄCºÍC++½Å±¾ºÍ³ÌÐò¡£ËùÓгÌÐò¶¼·ÖΪ²»Í¬µÄÀà±ð¡£
3¡¢http://www.planetsourcecode.com/vb/default.asp?lngWId=3 --³¬¹ýÍòÐÐCºÍC++Ãâ·ÑµÄÔ´´úÂë
4¡ ......

ÓÃcʵÏÖ±³°üÎÊÌ⣨̰ÐÄ£©

ºÃ¾ÃÒÔÇ°×öµÄÒ»¸ö³ÌÐò£¬Ì°ÐIJßÂÔʵÏÖ±³°üÎÊÌ⣬cʵÏÖ¡£
×ܽáÔÚÕâÀÒÔ±¸ÒÔºóºÍ±ðÈ˲éÕÒ¡£
//±³°üÎÊÌâ
#include "stdio.h"
#define MAX 10
void main()
{
 int w[MAX]={0,10,130,15,60,25};      //´æ·ÅÖÊÁ¿
 int v[MAX]={0,30,5,10,20,25};   //´æ·Å¼ÛÖµ
 flo ......

C rule

Àý) Σ険¤Ê¥³ー¥Ç¥£¥ó¥°
1                char cStr[256];
2                ZeroMemory(cStr, sizeof(cStr));
3      &nb ......

c ÓïÑÔÏÝÚå

Ô­Öø£ºAndrew Koenig - AT&T Bell Laboratories Murray Hill, New Jersey 07094
·­Ò룺lover_P
0 ¼ò½é
    CÓïÑÔ¼°ÆäµäÐÍʵÏÖ±»Éè¼ÆΪÄܱ»×¨¼ÒÃÇÈÝÒ×µØʹÓá£ÕâÃÅÓïÑÔ¼ò½à²¢¸½Óбí´ïÁ¦¡£µ«ÓÐһЩÏÞÖÆ¿ÉÒÔ±£»¤ÄÇЩ¸¡ÔêµÄÈË¡£Ò»¸ö¸¡ÔêµÄÈË¿ÉÒÔ´ÓÕâЩÌõ¿îÖлñµÃһЩ°ïÖú¡£
   &nbs ......

20100601 cÏÝÚåÓëÖ¸Õë¶ÁÊé±Ê¼Ç£¨µÚËÄÎåÁùÕ£©

  ÕâÈýÕÂÖ÷Òª½²ÁËCÓïÑÔµÄÁ´½Ó¡¢¿âº¯Êý¡¢Ô¤´¦Àí¡£»¹ÊÇÓеã»ÞɬÄѶ®°¡¡£
  Ò»¸öC³ÌÐòÊÇ¿ÉÒÔÓжà¸ö²¿·Ö×é³ÉµÄ£¬µ«ÊDZàÒëÆ÷ÿ´ÎÖ»ÄܱàÒëÒ»¸öÎļþ£¬ÕÒ³öÆäÖеĴíÎó¡£Ä³Ð©CÓïÑÔʵÏÖÌṩÁËÒ»¸ö³ÆΪlintµÄ³ÌÐò£¬¿ÉÒÔ²¶»ñ´óÁ¿µÄ´ËÀà´íÎó¡£Á¬½ÓÆ÷Ò»°ãÊÇÓë±àÒëÆ÷·ÖÀëµÄ£¬±àÒëÆ÷ÊÇ°ÑC³ÌÐò“·­Ò딳ɶÔÁ¬ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ