Sunday, July 31

C PROGRAM TO DISPLAY TYPE OF A FILE

Hi Friends, This is my C program to check the type of a file in UNIX system. Before going to program, have a look on what actually a 'type' means in UNIX system. A file may be one of the  following types :Regular File  : It may be either a text file or a binary file. Directory File : These are the files that can store other files (like file folder we use) so that users can organise their files into some hierarchical manner.!!) Character Device File : It refers to a physical device that transmits data in a character-based manner. (like printer, modems, consoles), Block Device File : Similar to character device...

Saturday, July 30

C PROGRAM TO IMPLEMENT MACRO PROCESSOR

 Here is my C program implementing a Macro Processor. We know that Macro is a single line abbreviation for a group of statements. We should define that sentence - cluster before using them in actual program. Macro processor will analyse the program and on encountering  macro variable, it will replace that 'Macro invocation' to corresponding Macro definition. It should also take care the number  and position of arguments used in Macro invocation. ALGORITHM MACROPROCESSOR EXPANDING=FALSE. Read each line and call GETLINE() and PROCESSLINE() until END encounters. PROCESSLINE ( ) If OPCODE is a macroname then EXPAND ( ). Else if OPCODE is MACRO ,then DEFINE ( ). Else write line to expanded file as such. DEFINE( ) Enter Macro name into NMATAB. Enter...

To Read Student Details and Make Rank List

Here is a simple C program that can be used to input students details. The program can store the details into a file and from that file it can make a rank list which can be written to another file.!! On reading the aim it is obvious that actual file handling may not be in same manner. But this program surely introduce you how Actual file 'read ' and 'write' occurs. Here we go.. STUDENT.C /**PROGRAM NAME:STUDENT.C*AIM : TO READ STUDENT DETAILS AND MAKE PROGRESS REPORT IN A FILE*OUTPUT FILE: STUDENT.TXT , PROGRESS. TXT*DATE: 07/30/2011*/ #include<stdio.h> #include<fcntl.h> struct student {       ...

Display the Contents of a Directory

    Here is a simple program to open and display the contents of a directory.                                               DIRECTORY.C /*PROGRAM NAME:DIRECTORY.CAIM:TO DISPLAY THE CONTENTS OF A DIRCTORYDATE:07/30/2011*/#include<stdio.h>#include<dirent.h> main(){char dirname[10];DIR *ptr;struct dirent *dir;printf("Enter the directory Name..");scanf("%s",dirname);ptr=opendir(dirname); printf("\nContents...

IMPLEMENTATION OF TWO PASS ASSEMBLER IN C

Hi friends, Here I'm posting a complete C program to implement a two pass assembler. A 2-pass assembler is a program that accepts an assembly language program as input and produces its machine language equivalent along with the information for the loader. The assembling of source program to object code requires to accomplish following functions. Convert mnemonic opcodes to their machine language equivalent.(e.g, LDA to 00) Convert symbolic operands to their equivalent machine address   (eg, LOOP to 2045) Allocate necessary memory. Convert data constants to internal machine equivalents. Write the object program and assembly...
Page 1 of 3012345Next