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)
Ïà¹ØÎĵµ£º
½ñÌìÊÇ5ÔµÄ×îºóÒ»ÌìÁË£¬2010ÄêµÄ5Ô£¬µ¹Ã¹µÄÒ»¸öÔÂÖÕÓÚÒª¹ýÈ¥ÁË¡£½ñÌì³é¿ÕÎÒÓÖ¶ÁÍêÁ˵ÚÈýÕ£¬Ë³±ã×öϱʼǡ£
ÕâÒ»ÕµÄÌâÄ¿½Ð×ö---ÓïÒå“ÏÝÚå”
³ÌÐòÒ²ÓпÉÄܱíÃæ¿´ÉÏÈ¥ÊÇÒ»¸öÒâ˼£¬Êµ¼ÊÉϵÄÒâ˼ȴÏàÈ¥ÉõÔ¶¡£
¶ÔÓÚÊý×飺
CÓïÑÔÖÐÖ»ÓÐһάÊý×飬 ......
°ÑÊäÈëµÄÒ»´®×Ö·ûת³ÉÊý×飬ת³ÉÁ´±í£¬È»ºóɾȥÆäÖÐÖ¸¶¨µÄ×Ö·û£¬ÔÚβ²¿Ìí¼ÓÒ»¸ö×Ö·û¡£
£¨³ÌÐò»¹²»ÍêÉÆ£¬Ã»ÓжÔÊä´íµÄÇé¿ö½øÐд¦Àí£¬£¬ÔÝʱÏÈÕâÑù°É¡£¡£= =¡££©
#include<stdio.h>
#include<malloc.h>
#define LEN sizeof(struct link)
struct link
{
char ch;
struct link *next;
}*string;
char a ......
̽Ë÷еÄC + +ºÍMFCÔÚVisual Studio 2010¹¦ÄÜ
Sumit Kumar
2010ÄêÁгöµÄVisual Studio C + +¿ª·¢µÄ¾Þ´óºÃ´¦¡£´Ó¹ÍÓÃÄÜÁ¦ÌṩÓÉWindows 7´óÁ¿´úÂëµÄ»ù´¡¹¤×÷£¬ÒÔÔöÇ¿Éú²úÁ¦ÌØÕ÷µÄÐÂÌØµã£¬ÓÐһЩÐµĶ«Î÷£¬Ìá¸ßÁ˼¸ºõËùÓеÄC + +¿ª·¢ÈËÔ±¡£
ÔÚÕâÆªÎÄÕÂÖУ¬ÎÒ½«½âÊÍ΢ÈíÒѾ½â¾öÁËÈçºÎÓÃC + +¿ª·¢ÈËÔ±ËùÃæÁٵĹ㷺µÄһЩÎÊÌ ......
ÔÚCÓïÑÔÖУ¬ÐÞÊηûexternÓÃÔÚ±äÁ¿»òÕߺ¯ÊýµÄÉùÃ÷ǰ£¬ÓÃÀ´ËµÃ÷“´Ë±äÁ¿/º¯ÊýÊÇÔڱ𴦶¨ÒåµÄ£¬ÒªÔÚ´Ë´¦ÒýÓÔ¡£
Ò».externÐÞÊαäÁ¿µÄÉùÃ÷
¾ÙÀýÀ´Ëµ£¬Èç¹ûÎļþa.cÐèÒªÒýÓÃb.cÖбäÁ¿int v£¬¾Í¿ÉÒÔÔÚa.cÖÐÉùÃ÷extern int v£¬È»ºó¾Í¿ÉÒÔÒýÓñäÁ¿v¡£ÕâÀïÐèҪעÒâµÄÊÇ£¬±»ÒýÓõıäÁ¿vµÄÁ´½ÓÊôÐÔ±ØÐëÊÇÍâÁ´½Ó£¨external£ ......