Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » read/write to /dev/rtp is happening .. but a small problem
Re: read/write to /dev/rtp is happening .. but a small problem [message #33805 is a reply to message #33784] Thu, 15 September 2011 08:42 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14267
Registered: November 2005
Ultimate Member
Monty.mvh wrote on Tue, 13 September 2011 08:02

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 );

	}

}



It is really not a good idea. File expects regular files.

If you insist on using Streams, you would have to develop your own. Perhaps look at Cout() implementation for that...

Mirek
 
Read Message
Read Message
Read Message
Previous Topic: Core: Null handling incoherent?
Next Topic: Linux and GetCurrentDirectory
Goto Forum:
  


Current Time: Mon Aug 04 00:32:43 CEST 2025

Total time taken to generate the page: 0.06363 seconds