Showing posts with the label header file

File inclusion in c

There are two ways to include a file in c # include ”filename” #include<filename> 1st one  is search in  current directory  and  specify list of directory  and  it also take full qualified file name. 2nd one  is search in  specify list of director y. But It has a advantage that is it can take  multiple file Name  at a time that is separated by semicolon ( ; ). Example- #include<file 1; file 2; file 3>

Connect to printer by C Program

#include<stdio.h> #include<conio.h> #include<stdlib.h> void main() { FILE *fp; char ch; fp=fopen(" full qulified file name that you want to read ","r"); if(fp==NULL) { printf("can not open file\n"); exit(1); } while((ch=fgetc(fp))!=EOF) { fputc(ch,stdprn); } fclose(fp); getch(); }

Type error “Java.util.Scanner.nosuchelementexception” || Exception || nosuchelementexception

This exception extends the  RuntimeException  class and thus, belongs to those exceptions that can be thrown during the operation of the  Java Virtual Machine (JVM) . It is an unchecked exception and thus, it does not need to be declared in a method’s or a constructor’s throws clause. The NoSuchElementException in Java The  NoSuchElementException   can be thrown by the following methods : Enumeration::nextElement() NamingEnumeration::next() StringTokenizer::nextElement() Iterator::next() All the aforementioned methods try to return the next element of an  enumeration  and throw that exception, in order to indicate that no more elements exist. example- import   java . util . HashSet ; import   java . util . Hashtable ; import   java . util . Set ; import   java . util . StringTokenizer ; public   class   NoSuchElementExceptionExample { public   static   void   main ( String [] args ) { Set sampleSet = new   HashSet (); Hashtable sampleTable =

How is the C language machine independent?

How is the C language machine independent? first of all c is  machine dependent  language, means we can not run a c program on another machine except in which it is programmed. machine independent  means source code of language can execute on any machine. ex java. View More

Why are header files needed in C?

Why are header files needed in C? Header file in any programming language used for including the library functions to that particular programming language. ex- stdio.h, conio.h, io.h and many more header files in c are used for including the library functions.