Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
C++ Programming for Linux Systems

You're reading from  C++ Programming for Linux Systems

Product type Book
Published in Sep 2023
Publisher Packt
ISBN-13 9781805129004
Pages 288 pages
Edition 1st Edition
Languages
Authors (2):
Desislav Andreev Desislav Andreev
Profile icon Desislav Andreev
Stanimir Lukanov Stanimir Lukanov
Profile icon Stanimir Lukanov
View More author details

Table of Contents (15) Chapters

Preface 1. Part 1:Securing the Fundamentals
2. Chapter 1: Getting Started with Linux Systems and the POSIX Standard 3. Chapter 2: Learning More about Process Management 4. Chapter 3: Navigating through the Filesystems 5. Chapter 4: Diving Deep into the C++ Object 6. Chapter 5: Handling Errors with C++ 7. Part 2:Advanced Techniques for System Programming
8. Chapter 6: Concurrent System Programming with C++ 9. Chapter 7: Proceeding with Inter-Process Communication 10. Chapter 8: Using Clocks, Timers, and Signals in Linux 11. Chapter 9: Understanding the C++ Memory Model 12. Chapter 10: Using Coroutines in C++ for System Programming 13. Index 14. Other Books You May Enjoy

Executing FS operations with C++

With C++17 FS operations that are closer to the system programming are facilitated. The FS library allows the C++ developer to distinguish between the Linux fs types and perform certain operations with them. Let’s take a look at an exemplary interface:

bool is_directory(const std::filesystem::path& p)

This method checks whether a given pathname is a directory. In a similar fashion, we can do the other type checks – is_fifo(), is_regular_file(), is_socket(), and is_symlink(). Can you tell why we don’t have the is_hardlink() method? That’s right – if two files with different character names point to a single inode, then both of them provide access to the same content. It doesn’t matter whether the inode’s hard link counter is higher than one, although we could get it through the hard_link_count() method.

As the C++ language is compilable on multiple OSes, the FS functions are also dependent...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}