亚洲最大看欧美片,亚洲图揄拍自拍另类图片,欧美精品v国产精品v呦,日本在线精品视频免费

  • 站長(zhǎng)資訊網(wǎng)
    最全最豐富的資訊網(wǎng)站

    C語(yǔ)言函數(shù)大全 u

    函數(shù)名: ultoa
    功  能: 轉(zhuǎn)換一個(gè)無(wú)符號(hào)長(zhǎng)整型數(shù)為字符串
    用  法: char *ultoa(unsigned long value, char *string, int radix);
    程序例:

    #include <stdlib.h>
    #include <stdio.h>

    int main( void )
    {
       unsigned long lnumber = 3123456789L;
       char string[25];

       ultoa(lnumber,string,10);
       printf(“string = %s  unsigned long = %lun”,string,lnumber);

       return 0;
    }
     
     
     

    函數(shù)名: ungetc
    功  能: 把一個(gè)字符退回到輸入流中
    用  法: int ungetc(char c, FILE *stream);
    程序例:

    #include <stdio.h>
    #include <ctype.h>

    int main( void )
    {
       int i=0;
       char ch;

       puts(“Input an integer followed by a char:”);

       /* read chars until non digit or EOF */
       while((ch = getchar()) != EOF && isdigit(ch))
          i = 10 * i + ch – 48; /* convert ASCII into int value */

       /* if non digit char was read, push it back into input buffer */
       if (ch != EOF)
          ungetc(ch, stdin);

       printf(“i = %d, next char in buffer = %cn”, i, getchar());
       return 0;
    }
     
     
     

    函數(shù)名: ungetch
    功  能: 把一個(gè)字符退回到鍵盤(pán)緩沖區(qū)中
    用  法: int ungetch(int c);
    程序例:

    #include <stdio.h>
    #include <ctype.h>
    #include <conio.h>

    int main( void )
    {
       int i=0;
       char ch;

       puts(“Input an integer followed by a char:”);

       /* read chars until non digit or EOF */
       while((ch = getche()) != EOF && isdigit(ch))
          i = 10 * i + ch – 48; /* convert ASCII into int value */

       /* if non digit char was read, push it back into input buffer */
       if (ch != EOF)
          ungetch(ch);

       printf(“nni = %d, next char in buffer = %cn”, i, getch());
       return 0;
    }
     
     
     

    函數(shù)名: unixtodos
    功  能: 把日期和時(shí)間轉(zhuǎn)換成DOS格式
    用  法: void unixtodos(long utime, struct date *dateptr,
       struct time *timeptr);
    程序例:

    #include <stdio.h>
    #include <dos.h>

    char *month[] = {“—“, “Jan”, “Feb”, “Mar”, “Apr”, “May”, “Jun”,
                     “Jul”, “Aug”, “Sep”, “Oct”, “Nov”, “Dec”};

    #define SECONDS_PER_DAY 86400L  /* the number of seconds in one day */

    struct date dt;
    struct time tm;

    int main(void)
    {
       unsigned long val;

    /* get today’s date and time */
       getdate(&dt);
       gettime(&tm);
       printf(“today is %d %s %dn”, dt.da_day, month[dt.da_mon], dt.da_year);

    /* convert date and time to unix format (number of seconds since Jan 1, 1970 */
       val = dostounix(&dt, &tm);
    /* subtract 42 days worth of seconds */
       val -= (SECONDS_PER_DAY * 42);

    /* convert back to dos time and date */
       unixtodos(val, &dt, &tm);
       printf(“42 days ago it was %d %s %dn”,
            dt.da_day, month[dt.da_mon], dt.da_year);
       return 0;
    }
     
     
     

    函數(shù)名: unlink
    功  能: 刪掉一個(gè)文件
    用  法: int unlink(char *filename);
    程序例:

    #include <stdio.h>
    #include <io.h>

    int main(void)
    {
       FILE *fp = fopen(“junk.jnk”,”w”);
       int status;

       fprintf(fp,”junk”);

       status = access(“junk.jnk”,0);
       if (status == 0)
          printf(“File existsn”);
       else
          printf(“File doesn’t existn”);

       fclose(fp);
       unlink(“junk.jnk”);
       status = access(“junk.jnk”,0);
       if (status == 0)
          printf(“File existsn”);
       else
          printf(“File doesn’t existn”);
     

       return 0;
    }
     
     
     

    函數(shù)名: unlock
    功  能: 解除文件共享鎖
    用  法: int unlock(int handle, long offset, long length);
    程序例:

    #include <io.h>
    #include <fcntl.h>
    #include <sysstat.h>
    #include <process.h>
    #include <share.h>
    #include <stdio.h>

    int main(void)
    {
       int handle, status;
       long length;

       handle = sopen(“c:\autoexec.bat”,O_RDONLY,SH_DENYNO,S_IREAD);

       if (handle < 0)
       {
           printf(“sopen failedn”);
           exit(1);
       }

       length = filelength(handle);
       status = lock(handle,0L,length/2);

       if (status == 0)
          printf(“lock succeededn”);
       else
          printf(“lock failedn”);

       status = unlock(handle,0L,length/2);

       if (status == 0)
          printf(“unlock succeededn”);
       else
          printf(“unlock failedn”);

       close(handle);
       return 0;
    }

     

    贊(0)
    分享到: 更多 (0)
    網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)