|
|
Home » U++ Library support » U++ Core » read/write to /dev/rtp is happening .. but a small problem
read/write to /dev/rtp is happening .. but a small problem [message #33784] |
Tue, 13 September 2011 14:02 |
Monty.mvh
Messages: 31 Registered: July 2011 Location: Bangalore
|
Member |
|
|
Hi,
I was able to perform read/write to /dev/rtp in upp using the below code structure..
#include <Core/Core.h>
using namespace Upp;
CONSOLE_APP_MAIN
{
struct read
{
unsigned int status;
unsigned int TimeOut;
};
read ReadArray;
FileStream file;
while ( 1 )
{
file.Open ( "/dev/rtp0",0 );
file.Read (0, &ReadArray, sizeof ( ReadArray ) );
Cout() << FormatInt(ReadArray.status )<< "\n";
sleep(1);
}
}
Here i used the class FileStream and the function file.Read();
To do this i had to do modifications in the header file stream.h
I changed the Class FileStream member function Read(); from Protected to Public.
But can i achieve the samething using class FileIn and its function Get();
I tried with the below code but did'nt get the incrementing pipe reading but got only a constant value repeating.
#include <Core/Core.h>
using namespace Upp;
CONSOLE_APP_MAIN
{
struct read
{
unsigned int status;
unsigned int TimeOut;
};
read ReadArray;
FileIn file;
while ( 1 )
{
file.Open ( "/dev/rtp0" );
file.Get ( &ReadArray, sizeof ( ReadArray ) );
Cout() << FormatInt ( ReadArray.status ) << "\n";
sleep ( 1 );
}
}
|
|
|
|
|
Goto Forum:
Current Time: Sat May 04 18:24:04 CEST 2024
Total time taken to generate the page: 0.01654 seconds
|
|
|