EOFEOF stands for End of File. The function getc() returns EOF, on success..Here is an example of EOF in C language, Let’s say we have "new.txt" file with the following content.This is demo! This is demo!Now, let us see the example.Example#include int main() { FILE *f = fopen("new.txt", "r"); int c = getc(f); while (c != EOF) { putchar(c); c = getc(f); } fclose(f); getchar(); return 0; }OutputThis is demo! This is demo!In the above program, file is opened by using fopen(). When integer variable c ... Read More
In HTML, both Id and Class are the element selector and are used to identify an element based on the name assign to these parameters. ID and Class selectors are the most widely used element selectors in CSS (HTML). The basic difference between ID and Class is that the ID selector is applied only to one element in a page, whereas the class selector can be applied to several elements on a single page. Read this article to find out more about "id" and "class" in HTML and how they are different from each other. What is ID in ... Read More
Introduction In SQL Server, you may sometimes need to update data in multiple tables at the same time. This can be done using a single UPDATE statement, which allows you to update multiple tables in a single query. To update two tables in one statement, you can use the UPDATE statement with a JOIN clause. The JOIN clause allows you to specify a relationship between the two tables that you want to update, based on a common column or set of columns. Definition The term "update two tables in one statement" refers to the process of using a single UPDATE ... Read More
In JavaScript, there are multiple ways to extract a number from a string. One way is to use the match() method and a regular expression to search for all numeric digits in the string. Another way is to use the replace() method and a regular expression to remove all nonnumeric characters from the string, leaving only the numbers. Let’s understand each of the methods with the help of some examples. Using the match() method and regular expression The regular expression is one kind of search pattern which we can create by combining multiple alphabetic and special characters. We can ... Read More
Using HTML forms, you can easily take user input. The tag is used to get user input, by adding the form elements. Different types of form elements include text input, radio button input, submit button, etc. The tag, helps you to take user input using the type attribute. To clear all the input in an HTML form, use the tag with the type attribute as reset. Example 1 The following example demonstrates how to clear all the input in HTML forms. In this example, we are going to use the document.getElementId() to clear the text in ... Read More
Using the following methods, we can clear the memory occupied by Matplotlib plots.plt.figure() - Create a new figure or activate an existing figure.plt.figure().close() - Close a figure window.close() by itself closes the current figureclose(h), where h is a Figure instance, closes that figureclose(num) closes the figure number, numclose(name), where name is a string, closes figure with that labelclose('all') closes all the figure windowsplt.figure().clear() - It is the same as clf.plt.cla() - Clear the current axes.plt.clf() - Clear the current figure.Examplefrom matplotlib import pyplot as plt fig = plt.figure() plt.figure().clear() plt.close() plt.cla() plt.clf()OutputWhen we execute the code, it will clear all the plots from ... Read More
What is an IP Address? An IP address (Internet Protocol address) is a numerical identifier, such as 192.0.2.1, that is associated with a computer network that communicates using the Internet Protocol. An IP address is used for two purposes: identifying a host or network interface, and addressing a specific location. An IP address has two primary functions: it identifies the host, or more particularly its network interface; and it indicates the host's position in the network, allowing a path to be established to that host. IP addresses can be either Public or Private. Read through this article to ... Read More
In this section we will see how DAC (Digital to Analog Converter) using Intel 8051 Microcontroller. We will also see the sinewave generation using DAC.The Digital to Analog converter (DAC) is a device, that is widely used for converting digital pulses to analog signals. There are two methods of converting digital signals to analog signals. These two methods are binary weighted method and R/2R ladder method. In this article we will use the MC1408 (DAC0808) Digital to Analog Converter. This chip uses R/2R ladder method. This method can achieve a much higher degree of precision. DACs are judged by its ... Read More
The internal data memory of 8051 is divided into two groups. These are a set of eight registers and a scratch pad memory. These eight registers are R0 toR7. The address range 00H to 07H is used to access the registers, and the rest are scratch pad memory. 8051 Provides four register bank, but only one register bank can be used at any point in time. To select the register bank, two bits of PSW (Program Status Word) are used.So the following addressing can be used to select register banks.Address RangeRegister Bank00H to 07HRegister Bank 008H to 0FHRegister Bank 110H to ... Read More
To count the total number of tables, use the concept of count(*) with table_schema. First, to check how many tables are present in our database "business", we need to use the 'show' command. mysql> show tables; The following is the output that displays all the tables in the database "business". +--------------------------+ | Tables_in_business | +--------------------------+ | addcheckconstraintdemo | | addcolumntable | | addconstraintdemo | | addnotnulldemo ... Read More