Reading from named FIFO on Linux
Show older comments
I am trying to read from a named fifo in the /tmp/ folder on the linux file system. I have one fifo which sends data to another named fifo and is recieved by a c++ program. Now I need to do that in reverse but I am struggling to recieve any data in MATLAB. I have some test code built in to my main matlab program at the point which the file needs to be read:
disp('Trying to read')
formatSpec = '%s %s';
count = 1;
while 1
disp(count)
A1 = fscanf(fileID_slam,formatSpec);
A2 = textscan(fileID_slam,formatSpec);
disp(A1)
disp(A2)
count = count + 1;
end
Assume the pipes were correctly setup.
What happens is it reaches disp(count) and then blocks until the c++ program ends and then loops infinitely reading [0x1] matrices and the current count value.
The C++ code is simply a loop which does the following:
pipe << test_num << std::endl;
pipe.flush();
test_num++;
If anyone has any advice on the best reading function to use in MATLAB for this situation or any reason why the read function might be blocking I would really appreciate it.
Accepted Answer
More Answers (0)
Categories
Find more on Whos in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!