Posts

Showing posts from May, 2018

Syntax highlight test

Trying to use syntax highlight:  c++: #include <iostream> using namespace std; int main() { cout << "Hello, World!"; return 0; } python: import matplotlib k=input() mylist=[] mylist.append(k)

Pipes. Let's start from something simple.

Again, something on Raspberry Pi (Raspbian/Debian), but there is a chance it would be useful for other systems.  I needed to direct a stream of data from c program to python script. To try the easiest way, I did small c program to send some data (string for this example) and another c program (to receive and print) and forced them to co-operate. Below is an explanation of how it is done. C sender to c receiver This is easy and often used form of creating a pipe (yes, we will use pipe to stream data from output of 'sender' to input of 'receiver'). Sender will print something out and receiver will accept this data. We will start from both programs being written in c, and then we will create a script in python to do the job of receiver. 1. pipesender.c #include <stdio.h&gt int main(){   printf("Message from sender\n");   return 0; } 2. pipereceiver.c #include <stdio.h> int main(){   char str1[21]; //buffer long enough for string from se