Ich bin relativ neu in QT lerne es seid gerade mal 3 Wochen.
Ich will ein Programm schreiben das eine Text Datei einließt, wo bei mich nur die erste Zahl in jeder Reihe interessiert.
Ich habe dieses Programm schon ohne QT also nur mit Linux Terminal zum laufen gebracht und hab dies nun in QT 3 versucht, klappt aber nicht.
mein Quell Code sieht wie folt aus:
Code: Alles auswählen
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <sys/types.h>
#include <sys/stat.h>
#include <cmath>
#include <iomanip>
using namespace std;
char on_off[100];
char line_buffer[1001];
float main_2D_array[100][4];
int x1=0;
int line_counter=0;
void Form1::click()
{
ifstream on_off("Versuch.txt");
while (! on_off.eof() )
on_off.getline(line_buffer, 150);
istringstream read_string(line_buffer);
read_string >>main_2D_array[x1][0]>>main_2D_array[x1][1];
x1++;
line_counter++;
textEdit1->setText(QString::number(main_2D_array[6][0]));
}
ich persöhnlich glaube das es an dem istringstream liegt, das man für QT ein anderen Befehl benötigt, jedoch finde ich kein.
ach ja und click() ist ein Befehl wenn ich den Pushbutton drück soll dieser Code ausgeführt werden.
mmh ich glaube dann hab ich alle informationen an euch weiter gegeben.
vielen dank schon einmal im Vorraus!
Mfg Metalmo