Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Title Page
Copyright and Credits
C Programming Cookbook
Dedication
Packt Upsell
Why subscribe?
Packt.com
Contributors
About the author
About the reviewer
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Download the color images
Conventions used
Sections
How to do it…
How it works…
There's more…
See also
Get in touch
Reviews
Section 1: Arrays, Strings, and Functions
Working with Arrays
Inserting an element in an array
How to do it…
How it works...
There's more...
Multiplying two matrices
How to do it…
How it works...
There’s more…
Finding the common elements in two arrays
How to do it…
How it works...
Finding the difference between two sets or arrays
How to do it…
How it works...
Finding the unique elements in an array
How to do it…
How it works...
Finding whether a matrix is sparse
How to do it…
How it works...
There's more...
Merging two sorted arrays into a single array
How to do it…
How it works...
Managing Strings
Determining whether the string is a palindrome
How to do it…
How it works...
Finding the occurrence of the first repetitive character in a string
How to do it…
How it works...
Displaying the count of each character in a string
How to do it…
How it works...
Counting vowels and consonants in a sentence
How to do it…
How it works...
Converting the vowels in a sentence to uppercase
How to do it…
How it works...
Exploring Functions
What is a stack?
Finding whether a number is an Armstrong number
How to do it…
How it works...
Returning maximum and minimum values in an array
How to do it…
How it works...
Finding the greatest common divisor using recursion
How to do it…
How it works...
Converting a binary number into a hexadecimal number
How to do it…
How it works...
Finding whether a number is a palindrome
How to do it…
How it works...
Section 2: Pointers and Files
Deep Dive into Pointers
What is a pointer?
Reversing a string using pointers
How to do it…
How it works...
Finding the largest value in an array using pointers
How to do it…
How it works...
Sorting a singly linked list
How to do it…
How it works...
Creating a singly linked list
Sorting the singly linked list
The first iteration
The second iteration
The third and fourth iterations
Finding the transpose of a matrix using pointers
How to do it…
How it works...
Accessing a structure using a pointer
How to do it…
How it works...
File Handling
Functions used in file handling
Functions commonly used in sequential file handling
fopen()
fclose()
fgets()
fputs()
Functions commonly used in random files
fseek()
ftell()
rewind()
Reading a text file and converting all characters after the period into uppercase
How to do it…
How it works...
Displaying the contents of a random file in reverse order
How to do it…
How it works...
Counting the number of vowels in a file
How to do it…
How it works...
Replacing a word in a file with another word
How to do it…
How it works...
Encrypting a file
How to do it…
How it works...
Section 3: Concurrency, Networking, and Databases
Implementing Concurrency
What are processes and threads?
Mutual exclusion
Performing a task with a single thread
How to do it…
How it works...
Performing multiple tasks with multiple threads
How to do it…
How it works...
Using mutex to share data between two threads
How to do it…
How it works...
Understanding how a deadlock is created
How to do it…
How it works...
Avoiding a deadlock
How to do it…
How it works...
Networking and Interprocess Communication
Communicating between processes using pipes
Creating and to connecting processes
pipe()
mkfifo()
write()
read()
perror()
fork()
One process, both writing and reading from the pipe
How to do it…
How it works...
One process writing into the pipe and another process reading from the pipe
How to do it…
How it works...
Communicating between processes using FIFO
Writing data into a FIFO
How to do it…
How it works...
Reading data from a FIFO
How to do it…
How it works...
Communicating between the client and server using socket programming
Client-server model
struct sockaddr_in structure
socket()
memset()
htons()
bind()
listen()
accept()
send()
connect()
recv()
Sending data to the client
How to do it…
How it works...
Reading data that's been sent from the server
How to do it…
How it works...
Communicating between processes using a UDP socket
Using a UDP socket for server-client communication
bzero()
INADDR_ANY
sendto()
recvfrom()
Await a message from the client and sending a reply using a UDP socket
How to do it…
How it works...
Sending a message to the server and receiving the reply from the server using the UDP socket
How to do it…
How it works...
Running Cygserver
Passing a message from one process to another using the message queue
Functions used in IPC using shared memory and message queues
ftok()
shmget()
shmat()
shmdt()
shmctl()
msgget()
msgrcv()
msgsnd()
Writing a message into the message queue
How to do it…
How it works...
Reading a message from the message queue
How to do it…
How it works...
Communicating between processes using shared memory
Writing a message into shared memory
How to do it…
How it works...
Reading a message from shared memory
How to do it…
How it works...
Using MySQL Database
Functions in MySQL
mysql_init()
mysql_real_connect()
mysql_query()
mysql_use_result()
mysql_fetch_row()
mysql_num_fields()
mysql_free_result()
mysql_close()
Creating a MySQL database and tables
Create database
Create table
Displaying all the built-in tables in a default mysql database
How to do it...
How it works...
Storing information in MySQL database
How to do it…
How it works...
Searching for the desired information in the database
How to do it…
How it works...
Updating information in the database
How to do it…
How it works...
Deleting data from the database using C
How to do it…
How it works...
Appendix A
Creating a sequential file and entering some data into it
How to do it…
How it works...
Reading content from a sequential file and displaying it onscreen
How to do it…
How it works...
Creating a random file and entering some data into it
How to do it…
How it works...
Reading content from a random file and displaying it onscreen
How to do it…
How it works...
Decrypting the contents of an encrypted file
How to do it…
How it works...
Appendix B
Installing Cygwin
Appendix C
Installing MySQL Server
Other Books You May Enjoy
Leave a review - let other readers know what you think
← Prev
Back
Next →
← Prev
Back
Next →