Remove Function in C/C++

Smita Kapse
Updated on 30-Jul-2019 22:30:25

295 Views

The C library function int remove(const char *filename) deletes the given filename so that it is no longer accessible.Following is the declaration for remove() function.int remove(const char *filename)This function takes the filename. This is the C string containing the name of the file to be deleted. On success, zero is returned. On error, -1 is returned, and errno is set appropriately.Example#include #include int main () {    int ret;    FILE *fp;    char filename[] = "file.txt";    fp = fopen(filename, "w");    fprintf(fp, "%s", "This is tutorialspoint.com");    fclose(fp);    ret = remove(filename);    if(ret == 0) { ... Read More

8085 Program to Simulate Decimal Down Counter

Arjun Thakur
Updated on 30-Jul-2019 22:30:25

671 Views

Now let us see a program of Intel 8085 Microprocessor. In this program we will see how to simulate the decimal down counter.Problem Statement:Write 8085 Assembly language program to simulate decimal down counter.Discussion:In this section we are simulating the decimal down counter. Here the counter will count 100 decimal numbers from 99 to 0. All values will be updated in each 0.5 seconds. For decimal count we are using the DAA instruction.Note: Here for simplicity we are storing the numbers into memory. To simulate it like a counter we can use 7-segment display to show the numbersInput:Here we are not ... Read More

Arithmetic Instructions in 8086 Microprocessor

George John
Updated on 30-Jul-2019 22:30:25

17K+ Views

These instructions are used to perform arithmetic operations like addition, subtraction, multiplication, division, etc. In 8086 the destination address is need not to be the accumulator.Let us see the arithmetic instructions of 8086 microprocessor. Here the D and S are destination and source respectively. D and S can be either register, data or memory address.OpcodeOperandDescriptionADDD, SUsed to add the provided byte to byte/word to word.ADCD, SUsed to add with carry.INCDUsed to increment the provided byte/word by 1.AAA----Used to adjust ASCII after addition.DAA----Used to adjust the decimal after the addition/subtraction operation.SUBD, SUsed to subtract the byte from byte/word from word.SBBD, SUsed ... Read More

Contains Method of Quintet Class in JavaTuples

karthikeya Boyini
Updated on 30-Jul-2019 22:30:25

78 Views

Use the contains() method to search a value in the Quintet class in JavaTuples.Let us first see what we need to work with JavaTuples. To work with Quintet class in JavaTuples, you need to import the following package −import org.javatuples.Quintet;Note − Steps to download and run JavaTuples program. If you are using Eclipse IDE to run Quintet Class in JavaTuples, then Right Click Project → Properties → Java Build Path → Add External Jars and upload the downloaded JavaTuples jar file.The following is an example −Exampleimport org.javatuples.Quintet; public class Demo { public static void main(String[] args) { ... Read More

Use JSP Plugin Action in JSP

George John
Updated on 30-Jul-2019 22:30:25

1K+ Views

The plugin action is used to insert Java components into a JSP page. It determines the type of browser and inserts the or tags as needed.If the needed plugin is not present, it downloads the plugin and then executes the Java component. The Java component can be either an Applet or a JavaBean.The plugin action has several attributes that correspond to common HTML tags used to format Java components. The element can also be used to send parameters to the Applet or Bean.Following is the typical syntax of using the plugin action −         ... Read More

Use of setFetchSize and setMaxRows Methods in JDBC Statement Interface

Daniol Thomas
Updated on 30-Jul-2019 22:30:25

2K+ Views

The setFetchSize(int) method defines the number of rows that will be read from the database when the ResultSet needs more rows. setFetchSize(int) affects how the database returns the ResultSet data.Whereas, setMaxRows(int) method of the ResultSet specifies how many rows a ResultSet can contain at a time. setMaxRows(int) affects the client side JDBC object.

Find Middle Element in a Linked List in Android

Smita Kapse
Updated on 30-Jul-2019 22:30:25

126 Views

This example demonstrate about How to finding middle element in a linked list in android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the above code, we have taken a text view to find the middle element.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.widget.TextView; import java.util.LinkedList; public class MainActivity extends AppCompatActivity { @RequiresApi(api ... Read More

The contains Method of the Java Ennead Tuple

Nishtha Thakur
Updated on 30-Jul-2019 22:30:25

113 Views

The contains() method of the Ennead Tuple in Java is used to search for a value in the Tuple. To find the existence of a value, you need to just set it as a parameter of the method. It returns a boolean value i.e. TRUE is returned for the existence of a value, else FALSE.Let us first see what we need to work with JavaTuples. To work with Ennead class in JavaTuples, you need to import the following package −import org.javatuples.Ennead;Note − Download JavaTuples Jar library to run JavaTuples program. If you are using Eclipse IDE, then Right Click Project ... Read More

Efficiently Perform Distinct with Multiple Keys in MongoDB

Nishtha Thakur
Updated on 30-Jul-2019 22:30:25

389 Views

You can perform distinct with multiple keys with the help of an aggregate framework.To understand the concept, let us create a collection with the document. The query to create a collection with a document is as follows −> db.distinctWithMultipleKeysDemo.insertOne({"StudentName":"Mike", "StudentAge":22, "StudentMathMarks":56}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c7f74488d10a061296a3c53") } > db.distinctWithMultipleKeysDemo.insertOne({"StudentName":"Mike", "StudentAge":22, "StudentMathMarks":56}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c7f744b8d10a061296a3c54") } > db.distinctWithMultipleKeysDemo.insertOne({"StudentName":"Bob", "StudentAge":23, "StudentMathMarks":45}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c7f74598d10a061296a3c55") } > db.distinctWithMultipleKeysDemo.insertOne({"StudentName":"Bob", "StudentAge":23, "StudentMathMarks":45}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c7f745e8d10a061296a3c56") } > db.distinctWithMultipleKeysDemo.insertOne({"StudentName":"Carol", "StudentAge":27, "StudentMathMarks":54}); {    "acknowledged" ... Read More

Handling Optional and Empty Data in MongoDB

George John
Updated on 30-Jul-2019 22:30:25

404 Views

In order to handle empty data, you can use $ne operator. Let us create a collection with documents. Following is the query>db.handlingAndEmptyDataDemo.insertOne({"StudentName":"John", "StudentCountryName":""}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9cbd5ca629b87623db1b12") } >db.handlingAndEmptyDataDemo.insertOne({"StudentName":"John", "StudentCountryName":null}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9cbd6ba629b87623db1b13") } > db.handlingAndEmptyDataDemo.insertOne({"StudentName":"John"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9cbd71a629b87623db1b14") }Following is the query to display all documents from a collection with the help of find() method> db.handlingAndEmptyDataDemo.find().pretty();This will produce the following output{    "_id" : ObjectId("5c9cbd5ca629b87623db1b12"),    "StudentName" : "John",    "StudentCountryName" : "" } {    "_id" : ObjectId("5c9cbd6ba629b87623db1b13"),    "StudentName" : ... Read More

Advertisements