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

The C Programming Language

To be continued...
µÚ8Õ UNIXϵͳ½Ó¿Ú
#include <stdio.h>
#include <fcntl.h>
#include "syscalls.h"
#defien PERMS 0666
void error(char *, ...);
/* cpº¯Êý: ½« f1 ¸´ÖƵ½ f2 */
int main(int argc, char *argv[])
{
    int f1, f2, n;
    char buf[BUFSIZ];
   
    if (argc != 3)
        error("Usage: c from to");
    if ((f1 = open(argv[1], O_RDONLY, 0)) == -1)
        error("cp: can't open %s", argv[1]);
    if ((f2 = creat(argv[2], PERMS)) == -1)
        error("cp: can't create %s, mode %03o", argv[2], PERMS);
    while ((n = read(f1, buf, BUFSIZ)) > 0)
        if (write(f2, buf, n) != n)
            error("cp: write error on file %s", argv[2]);
    return 0;
}
#include <stdio.h>
#include <stdarg.h>
/* errorº¯Êý: ´òÓ¡Ò»¸ö³ö´íÐÅÏ¢£¬È»ºóÖÕÖ¹ */
void error(char *fmt, ...)
{
    va_list args;
   
    va_start(args, fmt);
    fprintf(stderr, "error:");
    vfprintf(stderr, fmt, args);
    fprintf(stderr, "\n");
    va_end(args);
    exit (1);
}


Ïà¹ØÎĵµ£º

C#ÖÐһЩ×Ö·û´®²Ù×÷µÄ³£ÓÃÓ÷¨,c#±àÂëºÍ½âÂë

//»ñµÃºº×ÖµÄÇøÎ»Âë
¡¡¡¡byte[] array = new byte[2];
¡¡¡¡array = System.Text.Encoding.Default.GetBytes("°¡");
int i1 = (short)(array[0] - ''\0'');
¡¡¡¡int i2 = (short)(array[1] - ''\0'');
//unicode½âÂ뷽ʽϵĺº×ÖÂë
¡¡¡¡array = System.Text.Encoding.Unicode.GetBytes("°¡");
¡¡¡¡i1 = (short)(arra ......

C#ÀàºÍC#½á¹¹ÌåµÄ¹ØÏµ

C#ÀࣺÀàÊÇC# Öй¦ÄÜ×îΪǿ´óµÄÊý¾ÝÀàÐÍ£¬ÀàÒ²¶¨ÒåÁËÊý¾ÝÀàÐ͵ÄÊý¾ÝºÍÐÐΪ¡£È»ºó£¬³ÌÐòÔ±¿ÉÒÔ´´½¨×÷Ϊ´ËÀàµÄʵÀýµÄ¶ÔÏó¡£
C#½á¹¹Ì壺½á¹¹ÌåÊÇÇáÁ¿Ð͵ÄÀ࣬ʹÓÿªÏúÏà¶ÔÓÚÀà½ÏС¡£
C#ÀàºÍC#½á¹¹ÌåÁ½ÕߵĹØÏµ£º
1.Êý¾ÝÀàÐÍ£ºÀàºÍ½á¹¹Ìå¶¼ÊÇÊý¾ÝÀàÐÍ£¬ÀàÊÇÒýÓÃÀàÐÍ£¬½á¹¹ÌåÊÇÖµÀàÐÍ¡£
2.¼Ì³ÐÐÔ£ºÀà¿ÉÒԼ̳кͱ»¼Ì³Ð£¬¶ø½á¹ ......

²»ÓÃÁÙʱ±äÁ¿½»»»Á½¸öÊýµÄÖµ(CʵÏÖ)

µ±Òª½»»»Á½¸öÊýµÄֵʱ£¬Í¨³£µÄ×ö·¨ÊǶ¨ÒåÒ»¸öÁÙʱ±äÁ¿£¬È»ºóÔÙ½øÐн»»»¡£ÄÇôÄܲ»Äܲ»ÓÃÁÙʱ±äÁ¿¶ø½»»»Á½¸öÊýµÄֵĨ£¿¿ÉÒԵģ¡CÓïÑÔÌṩµÄÒì»òÔËËã¾Í¿ÉÒÔʵÏÖÕâÑùµÄ²Ù×÷¡£
 
Òì»òÔËËã·û^Ò²³ÆXORÔËËã·û£¬ËüµÄ¹æÔòÊÇÈô²Î¼ÓÔËËãµÄÁ½¸ö¶þ½øÎ»Í¬ºÅ£¬Ôò½á¹ûΪ0£¨¼Ù£©£»ÒìºÅΪ1£¨Õ棩¡£¼´0 ^ 0 = 0, 0 ^ 1 = 1, 1 ^ 0 = 1, ......

C Snippet #8(¹æ¶¨Ê±¼äÊäÈ룬·ñÔòĬÈÏÌø×ªµÄʵÏÖ)

http://www.ddj.com/cpp/221600722
Q: HOW DO I... put timers with default actions in my C code?
A: Many times, we need to write programs that will only wait a certain specified amount of time for a user to do something. After that time, we need to assume that the user isn't going to do anything and ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ