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

C/C++ÎļþµÄ²Ù×÷£¨fread() fwrite()£©

freadº¯ÊýºÍfwriteº¯Êý
1.º¯Êý¹¦ÄÜ
  ÓÃÀ´¶Áдһ¸öÊý¾Ý¿é¡£
2.Ò»°ãµ÷ÓÃÐÎʽ
  fread(buffer,size,count,fp);
  fwrite(buffer,size,count,fp);
3.˵Ã÷
  £¨1£©buffer£ºÊÇÒ»¸öÖ¸Õ룬¶ÔfreadÀ´Ëµ£¬ËüÊǶÁÈëÊý¾ÝµÄ´æ·ÅµØÖ·¡£¶ÔfwriteÀ´Ëµ£¬ÊÇÒªÊä³öÊý¾ÝµÄµØÖ·¡£
  £¨2£©size£ºÒª¶ÁдµÄ×Ö½ÚÊý£»
  £¨3£©count:Òª½øÐжÁд¶àÉÙ¸ösize×Ö½ÚµÄÊý¾ÝÏ
  £¨4£©fp:ÎļþÐÍÖ¸Õë¡£
 ×¢Ò⣺1 Íê³É´Îд²Ù(fwrite())×÷ºó±ØÐë¹Ø±ÕÁ÷(fclose());
           2 Íê³ÉÒ»´Î¶Á²Ù×÷(fread())ºó£¬Èç¹ûûÓйرÕÁ÷(fclose()),ÔòÖ¸Õë(FILE * fp)×Ô¶¯ÏòºóÒƶ¯Ç°Ò»´Î¶ÁдµÄ³¤¶È£¬²»¹Ø±ÕÁ÷¼ÌÐøÏÂÒ»´Î¶Á²Ù×÷Ôò½Ó×ÅÉϴεÄÊä³ö¼ÌÐøÊä³ö;
           3 fprintf() £º °´¸ñʽÊäÈëµ½Á÷£¬ÆäÔ­ÐÍÊÇint fprintf(FILE *stream, const char *format[, argument, ...]);ÆäÓ÷¨ºÍprintf()Ïàͬ£¬²»¹ý²»ÊÇдµ½¿ØÖÆ̨£¬¶øÊÇдµ½Á÷°ÕÁË¡£×¢ÒâµÄÊÇ·µ»ØֵΪ´Ë´Î²Ù×÷дÈëµ½ÎļþµÄ×Ö½ÚÊý¡£Èçint c = fprintf(fp, "%s %s %d %f", str1,str2, a, b) ;str1£º10×Ö½Ú£»str2£º 10×Ö½Ú£»a£º2×Ö½Ú£»b£º8×Ö½Ú£¬cΪ33£¬ÒòΪдÈëʱ²»Í¬µÄÊý¾Ý¼ä×Ô¶¯¼ÓÈëÒ»¸ö¿Õ¸ñ¡£
ÎļþʹÓÃÖ®ºóÒ»¶¨Òª¹Ø±Õ,·ñÔò½«²»ÄÜÕýÈ·ÏÔʾÄÚÈÝ.fwrite:¶ÁÈëÁ½¸öѧÉúÐÅϢȻºóÓÃfwrite´æÈëÎļþ
fread:ÓÃfread´ÓÎļþÖжÁ³öѧÉúÐÅÏ¢¡£
fwrite.c
#include <stdio.h>
#define SIZE 2
struct student_type
{
 char name[10];
 int num;
 int age;
 char addr[10];
}stud[SIZE];
void save()
{
 FILE *fp;
 int i;
 if((fp=fopen("stu_list","wb"))==NULL)
 {
  printf("cant open the file");
  exit(0);
 }
 for(i=0;i<SIZE;i++)
 {
   if(fwrite(&stud[i],sizeof(struct student_type),1,fp)!=1)
    printf("file write error\n");
 }
 fclose(fp);
}
main()
{
 int i;
 for(i=0;i<SIZE;i++)
 {
   scanf("%s%d%d%s",&stud[i].name,&stud[i].num,&stud[i].age,&stud[i].addr);
   save();
 }
 for(i=0;i<SIZE;i++)
 {
   printf("%s,%


Ïà¹ØÎĵµ£º

ÈçºÎʹÓÃObjective C½âÎöHTMLºÍXML

ʹÓÃObjective-C½âÎöHTML»òÕßXML£¬ÏµÍ³×Ô´øÓÐÁ½ÖÖ·½Ê½Ò»¸öÊÇͨ¹ýlibxml£¬Ò»¸öÊÇͨ¹ýNSXMLParser¡£²»¹ýÕâÁ½ÖÖ·½Ê½¶¼ÐèÒª×Ô¼ºÐ´ºÜ¶à±àÂëÀ´´¦ÀíץȡÏÂÀ´µÄÄÚÈÝ£¬¶øÇÒ²»ÊǺÜÖ±¹Û¡£
ÓÐÒ»¸ö±È½ÏºÃµÄÀà¿âhpple£¬ËüÊÇÒ»¸öÇáÁ¿¼¶µÄ°ü×°¿ò¼Ü£¬¿ÉÒԺܺõĽâ¾öÕâ¸öÎÊÌâ¡£ËüÊÇÓÃXPathÀ´¶¨Î»ºÍ½âÎöHTML»òÕßXML¡£
°²×°²½Ö裺
-¼ÓÈë libx ......

CÖÐÈçºÎµ÷ÓÃC++£¿C++ÖÐÈçºÎµ÷ÓÃC

CÖÐÈçºÎµ÷ÓÃC++£¿C++ÖÐÈçºÎµ÷ÓÃC?Õâ¸öÎÊÌâÊÇÐí¶àÈí¼þ¹«Ë¾ÃæÊÔ¹ý³ÌÖлáÎʵ½µÄÒ»¸ö³£¼ûÎÊÌâ¡£»Ø´ðÕâ¸öÎÊÌâ²¢²»À§ÄÑ£¬ÄǾÍÊÇʹÓÃ
extern "C",µ«ÊÇÃæÊÔ¹Ù¿ÉÄÜÏëͨ¹ýÕâ¸öÎÊÌâÁ˽âÄã¶ÔC/C++ÕÆÎյij̶ȡ£ÏÂÃæ×Ðϸ·ÖÎö¸ÃÎÊÌâ¡£
    Ê×ÏÈ£¬×÷
ΪexternÊÇC/C++ÓïÑÔÖбíÃ÷º¯ÊýºÍÈ«¾Ö±äÁ¿×÷Ó÷¶Î§£¨¿ ......

dz̸C/C++ÄÚ´æй©¼°Æä¼ì²â¹¤¾ß

BoundsChecker²ÉÓÃÒ»ÖÖ±»³ÆΪ Code InjectionµÄ¼¼Êõ£¬À´½Ø»ñ¶Ô·ÖÅäÄÚ´æºÍÊÍ·ÅÄÚ´æµÄº¯ÊýµÄµ÷Ó᣼òµ¥µØ˵£¬µ±ÄãµÄ³ÌÐò¿ªÊ¼ÔËÐÐʱ£¬BoundsCheckerµÄDLL±»×Ô¶¯ÔØÈë½ø³ÌµÄµØÖ·¿Õ¼ä£¨Õâ¿ÉÒÔͨ¹ýsystem-levelµÄHookʵÏÖ£©£¬È»ºóËü»áÐ޸Ľø³ÌÖжÔÄÚ´æ·ÖÅäºÍÊͷŵĺ¯Êýµ÷Óã¬ÈÃÕâЩµ÷ÓÃÊ×ÏÈתÈëËüµÄ´úÂ룬ȻºóÔÙÖ´ÐÐÔ­À´µÄ´úÂë¡£Bo ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ