This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iomanip> | |
#include <iostream> | |
#include <sys/stat.h> | |
std::ostream& operator<<(std::ostream& gozouta, const struct stat& st) { | |
gozouta << "File stat" << std::endl; | |
gozouta << "device: " << st.st_dev << " rdev: " << st.st_rdev << std::endl; | |
gozouta << "mode: " << std::oct << std::setfill('0') << std::setw(4) << st.st_mode << std::endl; | |
gozouta << "nlinks: " << std::dec << st.st_nlink << std::endl; | |
gozouta << "inode: " << std::dec << st.st_ino << std::endl; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ctime> | |
#include <sys/time.h> | |
#include <iostream> | |
std::ostream& operator<<(std::ostream& gozouta, const struct timespec& timspec) { | |
struct tm loctime; | |
char cbuf[512]; | |
(void) ::localtime_r(&timspec.tv_sec, &loctime); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdlib> | |
#include <algorithm> | |
// Delete duplicate entries from an array using C++ heap. | |
int *deleteDuplicates(int theArray[], size_t theArrayLength) | |
{ | |
int *topSortedArray = theArray + theArrayLength; | |
if (theArrayLength > 1) | |
{ | |
// Heap is in theArray[0:heapEnd-1] |