U. xml

Source: Internet
Author: User
Pre {border-style: solid; border-width: 1px; border-color: #000; line-Height: 1; color: # 0366ab; font-size: 16px ;}. sysfunc {color: #005080; font-style: italic; font-weight: bold ;}. selffuc {color: # 4bbc8b ;}. bool {color: #0c0a08 ;}. condition {color: #771334; font-weight: bold ;}. key {color: # d10bab ;}. vaR {color: #008023; font-style: italic ;}. digit {color: #5a0080; font-weight: bold ;}. includepre {color: # 0366ab ;}. operator_d {color: #008000; font-weight: bold ;}. operator_x {color: #440080; font-weight: bold ;}

Function Name :? Ultoa?

?? Yes :? Convert an unsigned long integer to a string?

Use ?? Method :? Char? * Ultoa (unsigned? Long? Value ,? Char? * String ,? Int? Radix );?

Program example :?

  
   #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?=?%lu\n",string,lnumber);????return?0;?}???????
   
  

Function Name :? Ungetc?

?? Yes :? Return a character to the input stream?

Use ?? Method :? Int? Ungetc (Char? C ,? File? * Stream );?

Program example :?

  
   #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?=?%c\n",?i,?getchar());????return?0;?}???????
   
  

Function Name :? Ungetch?

?? Yes :? Return a character to the keyboard buffer?

Use ?? Method :? Int? Ungetch (Int? C );?

Program example :?

  
   #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("\n\ni?=?%d,?next?char?in?buffer?=?%c\n",?i,?getch());????return?0;?}???????
   
  

Function Name :? Unixtodos?

?? Yes :? Convert date and time to DOS format?

Use ?? Method :? Void? Unixtodos (long? Utime ,? Struct? Date? * Dateptr ,?

  
   ???struct?time?*timeptr);?
   
  

Program example :?

  
   #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?%d\n",?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?%d\n",?????????dt.da_day,?month[dt.da_mon],?dt.da_year);????return?0;?}???????
   
  

Function Name :? Unlink?

?? Yes :? Delete a file?

Use ?? Method :? Int? Unlink (Char? * Filename );?

Program example :?

  
   #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?exists\n");????else???????printf("File?doesn‘t?exist\n");????fclose(fp);????unlink("junk.jnk");????status?=?access("junk.jnk",0);????if?(status?==?0)???????printf("File?exists\n");????else???????printf("File?doesn‘t?exist\n");??????return?0;?}???????
   
  

Function Name :? Unlock?

?? Yes :? Remove the File Share lock?

Use ?? Method :? Int? Unlock (Int? Handle ,? Long? Offset ,? Long? Length );?

Program example :?

  
   #include?<io.h>?#include?<fcntl.h>?#include?<sys\stat.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?failed\n");????????exit(1);????}????length?=?filelength(handle);????status?=?lock(handle,0L,length/2);????if?(status?==?0)???????printf("lock?succeeded\n");????else???????printf("lock?failed\n");????status?=?unlock(handle,0L,length/2);????if?(status?==?0)???????printf("unlock?succeeded\n");????else???????printf("unlock?failed\n");????close(handle);????return?0;?}??????????
   
  

Used in this article? Calligraphy and painting novel software? Released, the content has nothing to do with the software, and the painting and calligraphy novel software? More comfortable reading, more comfortable writing, and easier Publishing.

U. xml

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.