Computer networking programming, often referred as socket programming, is about writing programs to exchange information between processes running on connected hosts – computers, mobiles etc. Hosts are generally interconnected over a private network (LAN) or internet. In fact, the processes can run on a single host or computer also. Most applications today, desktop or mobile, … Continue reading “Networking Programming – Introduction to socket”
C Program to Append to a File
Appending to a means adding the new content at the end of the file retaining the old content intact. If the file is opened in normal write mode, the new content will replace the old content. Here we’ll see how to open a file in append mode Logic to Append to a File Declare a … Continue reading “C Program to Append to a File”
C Program to Write to a File
Writing to a file is a basic programming requirement. All information of a running program is generally stored in the physical memory or RAM. They are lost with the termination of the program. If you need to persist some information, you need to store it in some persistent storage like a disk. Writing to a … Continue reading “C Program to Write to a File”
C Program to Count Words in a File
We discussed different ways to count words in a string in this article. Here we’ll extend that to count all words in a file. We can think of a file as a collection of lines. We’ll count words of each line one by one and add them up. This program first opens the file, sample.txt, … Continue reading “C Program to Count Words in a File”
C Program to Implement Stack Using Array
Stack is a collection of data elements serving Last In First Out (LIFO) functionality – whichever element comes last will be removed first. This data structure helps solve a number of real life problems. Like undo / redo functionalities, recursive function implementation, solving arithmetic equations etc. Basic Stack Operations Push: Inserting a new element into … Continue reading “C Program to Implement Stack Using Array”