This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Fwd: can't read from ttyS0 with ifstream ( since gcc 3.2)
- From: Marcus Bretzler <m dot g dot b at gmx dot de>
- To: gcc-help at gcc dot gnu dot org
- Date: Tue, 26 Nov 2002 10:00:28 +0100 (MET)
- Subject: Fwd: can't read from ttyS0 with ifstream ( since gcc 3.2)
- References: <4215.1038300917@www55.gmx.net>
Hi everyone,
I have a problem since I changed the gcc version from 2.96 to 3.2.
I want to read from the ttyS0 with the ifstream function. with 2.96 it works
and if I run the program which is compiled with the g++ 2.96 the program
run,
if I compile it with the 3.2 the program doesn't run, the compiler builds no
errors.
the write to the ttyS0 works.
OS redhat 8.0 suse 8.1
here an example.
#include <iostream>
#include <fstream>
#include <cstdlib>
useing namespace std;
class CLasair
{
public:
CLasair();
int particleLesen();
void startSample();
int data[8];
protected:
char zero[110];
};
CLasair::CLasair()
{
}
int CLasair::particleLesen()
{
ifstream report ("/dev/ttyS0");
if (! report.is_open())
{
cout << "Error opening file"; exit (1);
}
report.getline (zero,100);
cout << "zero" << endl;
report >> data[1];
cout << "0,1 um: " << data[1] << endl;
return 0;
}
void CLasair::startSample()
{
ofstream start ("/dev/ttyS0");
start << "SS\n" << endl;
}
int main(void)
{
CLasair v;
v.startSample();
v.particleLesen();
return 0;
}
thank you in advance
--
+++ GMX - Mail, Messaging & more http://www.gmx.net +++
NEU: Mit GMX ins Internet. Rund um die Uhr für 1 ct/ Min. surfen!