Files in RAM

You can use tmpfs.  Use it like a normal hard drive with the path "/dev/shm" By default it's about half the size of the system's memory (you can check it's actual size by running df -h /dev/shm Copy a file to the ram space system("cp /home/pi/myfile.txt /dev/shm/my_file.txt");      

Read More

USB Drives

Connecting A USB Drive Finding It Note that “mydrivename” can be anything you want it to be, its the name you will use to connect to it Releasing It After Use

Read More

Get free disk space

Get free disk space int64_t free_disk_space; get_int64_value_from_ascii_string(do_console_command_get_result((char*)"df -k /tmp | tail -1 | awk '{print $4}'"), 0, &free_disk_space); //Get free space in kB std::cout << "Free disk space: " << free_disk_space << "kB" << std::endl;   int get_int64_value_from_ascii_string (string source_string, int char_index, int64_t *result) { int32_t value = -1; int32_t value_last = 0; char *p_source_string; […]

Read More

Searching a text file

Search for strings within a text file #include <stdlib.h> #include <stdio.h> #include <string.h> const char email_receive_set_output_high_string[] = {"set_output_high"}; const char email_receive_set_output_low_string[] = {"set output low"}; FILE *fp=fopen("/home/pi/myproject/somefile","r"); char tmp[1024] = {0x0}; while(fp != NULL && fgets(tmp, sizeof(tmp), fp) != NULL) //fgets gets one line at a time, up to the max size – not the […]

Read More