unixtodos()
Converts date and time from UNIX to DOS format
Declaration:
void unixtodos(long time, struct date *d, struct time *t);
Remarks:
unixtodos converts the UNIX-format time given in time to DOS format and
fills in the date and time structures *d and *t.
Return Value:
None
Example:
#include...
getverify() , setverify()
getverify gets the verify state
setverify sets the verify state
Declaration:
int getverify(void);
void setverify(int value);
Remarks:
getverify gets the current state of the verify flag.
setverify sets the current state of the verify flag to value.
The verify flag controls output to the disk.When it is off, writes are not...
sound(),nosound()
sound turns the PC speaker on at the specified frequency
nosound turns the PC speaker off
Declaration:
void sound(unsigned frequency);
void nosound(void);
Remarks:
sound turns on the PC's speaker at a given frequency.
nosound turns the speaker off after it has been turned on by a call to sound.
frequency specifies the frequency of...
setdate()
Gets or sets DOS system date
Declaration:
void setdate(struct date *datep);
Remarks:
setdate sets the system date to the date in *datep.
Return Value:
getdate: None
On success, returns 0
Otherwise, returns a non-zero value and
sets errno to EINVAL (Invalid date)
Program
#include <stdio.h>
#include <process.h>
#include <dos.h>
int...
getdate()
Gets or sets DOS system date
Declaration:
void getdate(struct date *datep);
Remarks:
getdate fills in the date structure *datep with the system's current date.
Return Value:
getdate: None
On success, returns 0
Otherwise, returns a non-zero value and
sets errno to EINVAL (Invalid date)
Program
#include <stdio.h>
#include<dos.h>
int...
poke(),pokeb()
poke stores an integer value at the memory location segment:offset
pokeb stores a byte value at the memory location segment:offset
Declaration:
void poke(unsigned segment, unsigned offset, int value);
void pokeb(unsigned segment, unsigned offset, char value);
Remarks:
poke stores the integer value at the memory location segment:offset.
pokeb...
keep()
Exits and remains resident
Declaration:
void keep(unsigned char status, unsigned size);
Remarks:
Both _dos_keep and keep use DOS function 0x31 to return to DOS with the exit status in status.
The current program remains resident.
These functions set the program to size paragraphs in length, and free the remainder of the memory of the program.
You...
**switch programs**
===================
#include<stdio.h>
#include<conio.h>
void main()
{
int a=100;
clrscr();
printf("\n mark1= ");
scanf("%d",&a);
switch(a/10)
{
case 0:
printf(" d class");
break;
case 1:
case 2:
case 3:
printf("c class");
break;
case 4:
case 5:
printf(" b class");
break;
...
**NESTED PROGRAME**
===================
Nested If statement means to use the if statement inside the other if
statement. Here we
are providing you an example using Nested-If statement
Program:
#include<studio.h>
#include<conio.h>
void main()
{
int x,y,z,max;
clrscr();
printf("\n x= ");
scanf("%d", &x);
printf("\n y= ");
scanf("%d",...
**DIVISIBLE NUMBERS**
=====================
#include<studio.h>
#include<conio.h>
void main()
{
int a;
clrscr();
printf("\n a=");
scanf("%d",&a);
if(a%7==0)
{
printf("\n The Number is Divisible by 7");
}
else
{
printf("\n The Number is not Divisible by 7");
}
getch();
...
#include<stdio.h>
#include<conio.h>
void main()
{
float a,r;
printf("\n Enter the Radious:");
scanf("%f", &r);
a=pi*r*r;
printf("\n area of the cicrle is %f", a);
getch(0;
}
Enter the radius :4
area of circle:50.12...
** ADD TWO NO's**
=================
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf("\n ENTER THE tWO nUMBERS:");
scanf("%d%d", &a,&b);
c-a<b;
printf("\n a,b = %d", c);
getch();
}
enter the two number :
10
20
c=30
...
getdta() gets disk-transfer address
Declaration:
char far *getdta(void);
Remarks:
getdta returns the current setting of the disk transfer address (DTA).
Return Value:
getdta returns a far pointer to the current DTA
Program
#include <dos.h>
#include <stdio.h>
int main(void)
{
char far *dta;
dta = getdta();
...
_dos_freemem() Frees a previously allocated DOS memory block
Declaration:
unsigned _dos_freemem(unsigned segx);
Remarks:
_dos_freemem frees a memory block allocated by a previous call to _dos_allocmem.
segx is the segment address of the block.
Return Value:
On success, both functions return 0 On error,_dos_freemem returns the DOS error code and sets...
Frees a previously allocated DOS memory block
Declaration:
int freemem(unsigned segx);
Remarks:
freemem frees a memory block allocated by a previous call to allocmem.
segx is the segment address of the block.
Return Value:
On success, both functions return 0
On error,
_dos_freemem returns the DOS error code and sets errno to ENOMEM (Bad memory...
Macros that disable and enable interrupts
Declaration:
void enable(void);
void _enable(void);
Remarks:
These macros provide programmers with flexible hardware interrupt control.
enable and _enable enable interrupts,
allowing any device interrupts to occur.
Only...
Macros that disable and enable interrupts
Declaration:
void disable(void);
void _disable(void);
Remarks:
These macros provide programmers with flexible hardware interrupt control.
disable and _disable disable interrupts.
allowing any device interrupts to occur.
Only the NMI (non-maskable...
Suspends execution for interval (milliseconds)
Declaration:
void delay(unsigned milliseconds);
Remarks:
With a call to delay, the current program is suspended from execution for
the time specified by the argument milliseconds.
It is not necessary to make a calibration call to delay before using it.
delay is accurate...
Accesses DOS system calls
Declaration:
int bdos(int dosfun, unsigned dosdx, unsigned dosal);
Remarks:
bdos provides direct access to many of the DOS system calls.
See your DOS reference manuals for details on each system call.
Use bdos for system calls that require an integer argument.
Use bdosptr if system...
Allocates DOS memory segment
Declaration:
int allocmem(unsigned size, unsigned *segp);
Remarks:
allocmem and _dos_allocmem use the DOS system call 0x48 to allocate a block
of free memory and return the segment address of the allocated block.
If not enough room is available, allocmem makes no assignment...
<a href="http://gan.doubleclick.net/gan_click?lid=41000000035692252&pubid=21000000000397534">Absread</a> reads absolute disk sectors
Declaration:
int absread(int drive, int nsects, long lsect, void *buffer);
Remarks:
absread uses DOS interrupt 0x25 to read specific disk sectors.
Both functions...
Pushes a character back to the keyboard
Declaration:
int ungetch(int ch);
Remarks:
ungetch pushes the character ch back to the console, causing ch to be the
next character read.
ungetch fails if it is called more than once before the next read.
Return Value:
On success, returns the character ch.
On...
<a href="http://gan.doubleclick.net/gan_click?lid=41000000035692252&pubid=21000000000397534">wherex</a> gives current horizontal cursor position
wherey gives current vertical cursor position
Declaration:
int wherex(void);
int wherey(void);
Remarks:
wherex returns the x-coordinate...
Gets text-mode video information
Declaration:
void gettextinfo(struct text_info *r);
Remarks:
gettextinfo fills in a structure with the current text video information.
Return Value:
gettextinfo does not return. The results are returned in the structure *r.
Example:
#include <conio.h>
int...
getche gets a character from console, and echoes to the screen
Declaration:
int getche(void);
Remarks:
getche reads a single character from the keyboard and echoes it to the
current text window, using direct video or BIOS.
Return Value:
Both functions return the character read from the keyboard.
program
#include...
gettext copies text from text-mode screen to memory
Declaration:
int gettext(int left, int top, int right, int bottom, void*destin);
Remarks:
gettext stores the contents of an onscreen text rectangle defined by
(left, top) and (right, bottom) into the area of memory *destin.
gettext reads the...
Reads a password
Declaration:
char *getpass(const char *prompt);
Remarks:
getpass reads a password from the system console, after prompting with the
null-terminated string prompt and disabling the echo.
It returns a pointer to a null-terminated string of up to eight characters
(not counting the null terminator).
Return...
Writes a string to the text window on the screen
Declaration:
int <a href="http://gan.doubleclick.net/gan_click?lid=41000000035692252&pubid=21000000000397534">cputs</a>(const char *str);
Remarks:
cputs writes the null-terminated string str to the current text window. It
does not append a newline character.
The...
getch gets a character from console but does not echo to the screen
Declaration:
int getch(void);
Remarks:
getch reads a single character directly from the keyboard, without echoing
to the screen.
Return Value:
Both functions return the character read from the keyboard.
Progarm
#include <conio.h>
#include...
(Text mode): Deletes line in text window
Declaration:
void delline(void);
Remarks:
delline deletes the line containing the cursor and moves all lines below it
one line up.
delline operates within the currently active text window.
Return Value:
None
Example:
#include <conio.h>
int...
Clears text mode window
Declaration:
void clrscr(void);
Remarks:
clrscr clears the current text window and places the cursor in the upper
left-hand corner (at position 1,1).
Return Value:
None
Example:
#include <conio.h>
int main(void)
{
int i;
clrscr();
...
Clears to end of line in text window
Declaration:
void <a href="http://gan.doubleclick.net/gan_click?lid=41000000035692252&pubid=21000000000397534">clreol</a>(void);
Remarks:
clreol clears all characters from the cursor position to the end of the line
within the current text window, without moving the cursor.
Return...
Reads string from console
Declaration:
char *cgets(char *str);
Remarks:
cgets reads a string of characters from the console and stores the string
(and the string length) in the location *str.
Before you call cgets, set str[0] to the maximum length of the string to be
read.
cgets reads characters until it encounters a carriage-return/linefeed
combination...