C/C++——С±à̸CÓïÑÔº¯ÊýÄÇЩÊÂ(26)
C³ÌÐòÊÇÓÉÒ»×é»òÊDZäÁ¿»òÊǺ¯ÊýµÄÍⲿ¶ÔÏó×é³ÉµÄ¡£ º¯ÊýÊÇÒ»¸ö×ÔÎÒ°üº¬µÄÍê³ÉÒ»¶¨Ïà¹Ø¹¦ÄܵÄÖ´ÐдúÂë¶Î¡£ÏÂÃæÐ¡±àºÍ´ó¼Ò·ÖÏíÏÂCÓïÑÔÖеĺ¯Êý¡£
1. sopenº¯Êý
sopenº¯ÊýµÄ¹¦ÄÜÊÇ´ò¿ªÒ»¹²ÏíÎļþ£¬ÆäÓ÷¨Îª£ºint sopen(char *pathname, int access, int shflag, int permiss);³ÌÐòʵÀýÈçÏ£º
#include <io.h>
#include <fcntl.h>
#include <sys\stat.h>
#include <process.h>
#include <share.h>
#include <stdio.h>
int main(void)
{
int handle;
int status;
handle = sopen("c:\\autoexec.bat", O_RDONLY, SH_DENYNO, S_IREAD);
if (!handle)
{
printf("sopen failed\n");
exit(1);
}
status = access("c:\\autoexec.bat", 6);
if (status == 0)
printf("read/write access allowed\n");
else
printf("read/write access not allowed\n");
close(handle);
return 0;
}
2. spawnlº¯Êý
spawnlº¯ÊýµÄ¹¦ÄÜÊÇ´´½¨²¢ÔËÐÐ×Ó³ÌÐò£¬ÆäÓ÷¨Îªint spawnl(int mode, char *pathname, char *arg0,arg1, ... argn, NULL);³ÌÐòʵÀý´úÂëÈçÏ£º
#include <process.h>
#include <stdio.h>
#include <conio.h>
int main(void)
{
int result;
clrscr();
result = spawnl(P_WAIT, "tcc.exe", NULL);
if (result == -1)
{
perror("Error from spawnl");
exit(1);
}
return 0;
}
3. srandº¯Êý
srandº¯ÊýµÄ¹¦ÄÜÊdzõʼ»¯Ëæ»úÊý·¢ÉúÆ÷, ÆäÓ÷¨Îª£ºvoid srand(unsigned seed);³ÌÐòʵÀý´úÂëÈçÏ£º
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
int main(void)
{
int i;
time_t t;
srand((unsigned) time(&t));
printf("Ten random numbers from 0 to 99\n\n");
fo
Ïà¹ØÎĵµ£º
C³ÌÐòÊÇÓÉÒ»×é»òÊDZäÁ¿»òÊǺ¯ÊýµÄÍⲿ¶ÔÏó×é³ÉµÄ¡£ º¯ÊýÊÇÒ»¸ö×ÔÎÒ°üº¬µÄÍê³ÉÒ»¶¨Ïà¹Ø¹¦ÄܵÄÖ´ÐдúÂë¶Î¡£ÏÂÃæÐ¡±àºÍ´ó¼Ò·ÖÏíÏÂCÓïÑÔÖеĺ¯Êý¡£
1. setallpalletteº¯Êý
setallpalletteº¯ÊýµÄ¹¦ÄÜÊǰ´Ö¸¶¨·½Ê½¸Ä±äËùÓеĵ÷É«°åÑÕÉ«£¬ÆäÓ÷¨Îª£ºvoid far setallpallette(struct palette, fa ......
C/SÊǿͻ§¶Ë/·þÎñÆ÷¶Ë£¬C/SµÄ³ÌÐòͨ³£Ò²½ÐÅÖ¿Í»§¶Ë£¬Ò²¾ÍÊÇÒ»¸ö³ÌÐòµÄ´ó²¿·Ö¹¦ÄÜ£¬¶¼ÔÚ¿Í»§¶ËʵÏÖ£¬¶ø·þÎñÆ÷¶ËֻʵÏÖһС²¿·Ö¹¦ÄÜ¡£Í¨¹ýÕâµã²»ÄÑ¿´³ö£¬C/SµÄ³ÌÐò´ó²¿·ÖÔÚ¿Í»§¶ËʵÏÖ£¬¶ÔÓÚ·þÎñÆ÷¶ËµÄѹÁ¦Ïà¶ÔСһЩ£¬·þÎñÆ÷¶Ë¿ÉÒÔ½ÚʡһЩ¡£¶øÇÒC/SµÄ³ÌÐòÓô°¿ÚÀ´×ö£¬¸öÈËÈÏΪ¿ª·¢Ð§ÂÊÉÏ¿ìÒ»µã¡£µ«C/SµÄ³ÌÐòÒ»´ó±×¶Ë¾ÍÊÇ£¬±Ø ......
C³ÌÐòÊÇÓÉÒ»×é»òÊDZäÁ¿»òÊǺ¯ÊýµÄÍⲿ¶ÔÏó×é³ÉµÄ¡£ º¯ÊýÊÇÒ»¸ö×ÔÎÒ°üº¬µÄÍê³ÉÒ»¶¨Ïà¹Ø¹¦ÄܵÄÖ´ÐдúÂë¶Î¡£ÏÂÃæÐ¡±àºÍ´ó¼Ò·ÖÏíÏÂCÓïÑÔÖеĺ¯Êý¡£
1. settextstyleº¯Êý
settextstyleº¯ÊýµÄ¹¦ÄÜÊÇΪͼÐÎÊä³öÉèÖõ±Ç°µÄÎı¾ÊôÐÔ£¬ÆäÓ÷¨Îª£ºvoid far settextstyle (int font, int direction, char size);³ ......