Search
Sponsors
Sponsors

Browser Version

September 30th, 2009

 

<!– Copy this code into the BODY section –>

<BODY>

<CENTER>
<SCRIPT LANGUAGE="JavaScript">
document.write("<B>"+navigator.appVersion+"</B><P>");
</SCRIPT>
</CENTER>

 

Note

I use Google Chrome and it displayed

5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.19 (KHTML, like Gecko) Chrome/1.0.154.53 Safari/525.19

is the floppy disk ready

April 1st, 2009

#include
#include

void main(void)
{
char buffer[8192];

// Try reading head 1, track 1, sector 1
if (biosdisk(2, 0, 1, 1, 1, 1, buffer))
printf(”Error accessing driven”);
else
printf(”Drive readyn”);
}

get the size of a file

March 31st, 2009

#include
#include
#include
#include

int main()
{
int fp;

long file_size;

if ((fp = open(”f:/cprojects/urls.txt”, O_RDONLY)) == -1)
printf(”Error opening the file n”);
else
{
file_size = filelength(file_handle);
printf(”The file size in bytes is %ldn”, file_size);
close(fp);
}
return 0;
}

file attributes

March 30th, 2009

#include
#include

int main()
{
int mode;
/*check a files attributes*/
mode = access(”f:/cprojects/urls.txt”,0);
if(mode)
printf(”File does not exist.n”);
else
/*check if the file can be written to*/
mode = access(”f:/cprojects/urls.txt”,2);
if(mode)
printf(”File cannot be written.n”);
else
printf(”file can be written to.n”);

/*check if file can be read*/
mode = access(”f:/cprojects/urls.txt”,4);
if(mode)
printf(”File cannot be read.n”);
else
printf(”File can be read.n”);

/*check if afile can be read/written*/
mode = access(”f:/cprojects/urls.txt”,6);
if(mode)
printf(”File cannot be read/written to.n”);
else
printf(”File can be read/written to.n”);

return 0;
}

feet metres centimetres conversion

March 28th, 2009

#include

int main()
{
float feet,metres,centimetres;
printf(”Enter the amount of feet you wish to convert.n”);
scanf(”%f”,&feet);

while(feet > 0)
{
centimetres = feet * 12 * 2.54;
metres = centimetres / 100;
printf(”%6.2f feet is equal to n”,feet);
printf(”%6.2f metresn”,metres);
printf(”%8.2f centimetresn”,centimetres);
printf(”Enter another value to be converted or n”);
printf(”enter 0 to exit.n”);
scanf(”%f”,&feet);
}
return 0;
}

fat file system information

March 27th, 2009

#include
#include

void main(void)
{
struct fatinfo fat;

getfatd(&fat);

printf(”Sectors per cluster %dn”, fat.fi_sclus);
printf(”Clusters per disk %un”, fat.fi_nclus);
printf(”Bytes per cluster %dn”, fat.fi_bysec);
printf(”Disk type %xn”, fat.fi_fatid & 0xFF);
}

exe file information

March 26th, 2009

#include
struct EXEHEAD

{
char id[2]; // ‘M’ & ‘Z’
unsigned lastpg; // no of bytes on last page
unsigned size; // total no of 512 byte pages
unsigned reloc; // no of relocation table items
unsigned headersize; // header size in paras
unsigned minpara; // min. paras reqd. by prog.
unsigned maxpara; // max. paras reqd. by prog.
unsigned stackseg; // initial value of stack seg.
unsigned stackoff; // initial value of SP
unsigned chksum; // header check sum
unsigned IP; // entry point IP
unsigned CS; // entry point CS
unsigned relocoff; // offset of 1st relocation item
unsigned char overlay; // overlay number
};
int main(int argc, char *argv[])

{
FILE *fp;
struct EXEHEAD exehead;
if((fp = fopen(”sound.exe”, “rb”)) == NULL)

{
printf(”ERROR: file open errorn”);
return 1;
}
fread(&exehead, sizeof(exehead), 1, fp);
printf(”EXE file signature: %c%cn”, exehead.id[0], exehead.id[1]);
printf(”Total bytes on last sectors: %un”, exehead.lastpg);
printf(”Total sectors(1 sector = 512 bytes): %un”, exehead.size);
printf(”No. of relocation table items: %un”, exehead.reloc);
printf(”Header size in paragraphs: %un”, exehead.headersize);
printf(”Min. paras. reqd. by program: %un”, exehead.minpara);
printf(”Max. paras. reqd. by program: %un”, exehead.maxpara);
printf(”Initial value of SS: %un”, exehead.stackseg);
printf(”Initial value of SP: %un”, exehead.stackoff);
printf(”Header checksum: %un”, exehead.chksum);
printf(”Initial value of IP: %un”, exehead.IP);
printf(”Initial value of CS: %un”, exehead.CS);
printf(”Offset of 1st relocation item: %un”, exehead.relocoff);
printf(”Overlay number: %dn”, exehead.overlay);

return 0;
}

enumeration example

March 25th, 2009

#include

typedef enum{Sun,Mon,Tue,Wed,Thu,Fri,Sat}days;

int main()
{
days number;
printf(”Please enter the number of the day of the week.n”);
scanf(”%d”,&number);
switch(number)
{
case 0 : printf(”the day is Sunday.n”); break;
case 1 : printf(”the day is Monday.n”); break;
case 2 : printf(”the day is Tuesday.n”); break;
case 3 : printf(”the day is Wednesday.n”); break;
case 4 : printf(”the day is thursday.n”); break;
case 5 : printf(”the day is Friday.n”); break;
case 6 : printf(”the day is saturday.n”); break;
}
return 0;
}

english to french dictionary

March 23rd, 2009

#include
#include

char dict[][2][40] = {
“hello”,”bonjour” ,
“year”,”annee” ,
“good”,”bon” ,
“car”,”voiture” ,
“house”,”maison” ,
“yes”,”oui” ,
“friend”,”ami” ,
“road”,”rue” ,
“”,”"
};

int main(void)
{
int i = 0;
char word[80];

printf(”Enter a word in English to search for.n”);
gets(word);
while(strcmp(dict[i][0],”"))
{
if(!strcmp(word,dict[i][0]))
{
printf(”French equivalent is : %sn”,dict[i][1]);
break;
}
i++;
}

if(!strcmp(dict[i][0], “”))
printf(”Word not found.n”);

return 0;
}

empty recent documents folder

March 22nd, 2009

#include
#include
#define WIN32_LEAN_AND_MEAN

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{

if(MessageBox(NULL, “Press ok to empty the Recent documents folder.”, “recycler”, MB_YESNO | MB_ICONINFORMATION) != IDYES)
return FALSE;

SHAddToRecentDocs(SHARD_PATH, NULL);

return FALSE ;
}

Translate
Tags