C language Function--o

Source: Internet
Author: User




Calligraphy and painting fiction software making more enjoyable reading, more comfortable writing, easier to publish

The most complete classical fiction net published by the software







Function Name: Open

Function: Open a file for reading or writing

Usage: int open (char *pathname, int access[, int permiss]);

program Example:

#include <string.h>#include <stdio.h>#include <fcntl.h>#include <io.h>intMain(void){intHandle;Charmsg[] = "Hello World";if((Handle=Open("test.$$$", O_creat | O_text))==-1){Perror("Error:");return1;}Write(Handle,msg, strlen(msg));Close(Handle);return0;}

Function Name: outport

Function: output integer to Hardware port

Usage: void outport (int port, int value);

program Example:

#include <stdio.h>#include <dos.h>intMain(void){intvalue = -;intPort=0; Outportb(Portvalue);printf("Value%d sent to port Number%d\n ",value, Port);return0;}

Function Name: OUTPORTB

function: Output byte to hardware port

Usage: void outportb (int port, char byte);

program Example:

#include <stdio.h>#include <dos.h>intMain(void){intvalue= -;intPort=0; Outportb(Portvalue);printf("Value%d sent to port Number%d\n ",value, Port);return0;}

Function Name: Outtext

Function: Displays a string in the viewport

Usage: void far outtext (char far *textstring);

program Example:

#include <graphics.h>#include <stdlib.h>#include <stdio.h>#include <conio.h>intMain(void){/* RequestAutoDetection * *intGdriver=DETECT, Gmode, errorcode;intMidx, Midy; /* Initialize graphics and local variables */initgraph(&gdriver, &gmode, ""); /*ReadResult of initialization */ErrorCode=Graphresult();if (ErrorCode! = GrOk)/* An error occurred */{printf("Graphics Error:%s\n", grapherrormsg(ErrorCode));printf("Press any key to halt:");Getch(); Exit(1); /* Terminate with an error code */}Midx=Getmaxx()/2; Midy=Getmaxy()/2; /* Move the C.P to the center of the screen */MoveTo(Midx, Midy); /* Output text starting at the C.P. */Outtext(" This"); Outtext(" is"); Outtext("A"); Outtext("Test."); /* Clean up */Getch(); Closegraph();return0;}

Function Name: Outtextxy

Function: Displays a string at the specified location

Usage: void far outtextxy (int x, int y, char *textstring);

program Example:

#include <graphics.h>#include <stdlib.h>#include <stdio.h>#include <conio.h>intMain(void){/* RequestAutoDetection * *intGdriver=DETECT, Gmode, errorcode;intMidx, Midy; /* Initialize graphics and local variables */initgraph(&gdriver, &gmode, ""); /*ReadResult of initialization */ErrorCode=Graphresult();if(ErrorCode! = GrOk)/* An error occurred */{printf("Graphics Error:%s\n", grapherrormsg(ErrorCode));printf("Press any key to halt:");Getch(); Exit(1); /* Terminate with an error code */}Midx=Getmaxx()/2; Midy=Getmaxy()/2; /* Output text at the center of the screen*//* note:the c.p. doesn ' t get changed.*/outtextxy(Midx, Midy, " This isA test. "); /* Clean up */Getch(); Closegraph();return0;}



Calligraphy and painting fiction software making more enjoyable reading, more comfortable writing, easier to publish

The most complete classical fiction net published by the software

C language Function--o

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.