Tapas Kumar Ghosh has Published 226 Articles

How can I get a file\'s size in C++?

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 01-Jul-2025 15:07:34

15K+ Views

In C++, the file size determines the total number of bytes. To get the file size, we can take reference of the fstream header which contains various functions such as in_file(), seekg(), and tellg(). Example Input: The file name is tp.txt content- "Hello Tutorialspoint" Output: Size of the file is ... Read More

Is it safe to delete a void pointer in C/C++?

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 17-Jun-2025 16:21:04

1K+ Views

The void pointer is a pointer which is not associate with any data types. It points to some data location in storage means points to the address of variables. It is also called general purpose pointer. Is It Safe to Delete a Void Pointer in C/C++? It is not safe ... Read More

How to use range-based for() loop with std::map?

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 17-Jun-2025 16:12:50

2K+ Views

In C++, a map is defined by an element storage container in the form of key-value pairs where each key is unique and mapped with a respective value. While range-based for loop is a very simple approach to iterate over elements in the container. In this article, we will learn the usage of range-based for loop over std::map ... Read More

How to compare pointers in C/C++?

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 17-Jun-2025 14:57:16

8K+ Views

The pointers can be directly compared using relational operators. In this article, we will learn about the comparisons of the pointers with the help of examples. Pointers Comparison in C and C++ In C/C++, we can directly compare the pointers using relational operators (==, !=, , =). These operators are ... Read More

What is the difference between iostream and iostream.h in C++?

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 16-Jun-2025 17:07:37

1K+ Views

Both and are the header files of C++ language. The .h extension was common in older, non-standard implementations like Turbo C++. The  has been deprecated in modern C++ compilers and the  became part of the C++ standard starting from the 1998 ANSI/ISO standard. The Header File The ... Read More

How to create timer using C++11?

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 16-Jun-2025 17:01:42

2K+ Views

The term "timer" is used to define the time based operations on hours, minutes, and seconds. Here, we can use the chrono library of C++ that helps to set the different timer operations like countdown, delayed, current time, etc. In this article, we will learn how to create a timer ... Read More

Scope Resolution Operator vs this pointer in C++

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 16-Jun-2025 17:00:00

487 Views

Both scope resolution operator and 'this' pointer are used for different purposes in the C++ programs. The scope resolution operator is used to access static or class members whereas this pointer is used to access object members when there is a local variable with the same name. Scope Resolution Operator ... Read More

Undefined Behaviour in C and C++

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 16-Jun-2025 16:53:18

366 Views

In C/C++, undefined behavior refers to unexpected program output. When we write any program based on C or C++, sometimes we do not get the output as expected. This may be due to undefined behavior which cannot be predictable. For reference, sometimes it will show correct result, sometimes it will ... Read More

What is the C++ equivalent of sprintf?

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 16-Jun-2025 16:48:56

3K+ Views

The sprintf() function of C library equivalent to C++ that is used to create strings with a specified format like custom text with numbers or names. In C++, we can perform the same operation as in C with the help of ostringstream.C++ std::ostringstreamThe ostringstream is known for the output string ... Read More

Self Destructing Code in C

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 13-Jun-2025 14:27:16

1K+ Views

The self-destructing code is a type of program that can delete itself. It automatically executes the program and then removes the executable file once the execution is done. In this article, we will learn how to write self-destructing code for a C program. Write a Self Destructing Code in C++ ... Read More

Advertisements