daten aus TextFile aus lesen
-
hallo
iam writing a program that read data from a text file that send it to an other target
the problem is that i get always new data in my test file and my program read just the first one .i need to read always the new one
can some one help me please because it is a part of my diplomarbe
my code is:#include <fstream>
#include <string>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys\types.h>
#include <sys\stat.h>
#include <ctype.h>
#include <windows.h>static WORD readFile(char *FileName, BYTE *UserData)
{
std::fstream InputFile(FileName, std::ios_base::in );if (InputFile.is_open()) {
std::string Line1;
std::string Line2;
std::string Line3;
std::string Line4;
std::string Line5;
std::string Line6;std::getline(InputFile, Line1);
std::cout << Line1<< std::endl;
std::getline(InputFile, Line2);
std::cout << Line2<< std::endl;
std::getline(InputFile, Line3);
std::cout << Line3<< std::endl;
std::getline(InputFile, Line4);
std::cout << Line4<< std::endl;
std::getline(InputFile, Line5);
std::cout << Line5<< std::endl;
std::getline(InputFile, Line6);
std::cout << Line6<< std::endl;sprintf((char *)UserData, "%s\n%s\n%s\n%s\n%s\n%s\n",
Line1.c_str(),
Line2.c_str(),
Line3.c_str(),
Line4.c_str(),
Line5.c_str(),
Line6.c_str());return(WORD)strlen((char *)UserData);
}
return 0;
int main(int argc, char *argv[])
{BYTE UserData[4096];
DWORD ErrorCode;
WORD DataSize;
char Buf[256];GetParameters(argc, argv);
/*
* set buffer to zero always
*/
memset(UserData, 0, sizeof(UserData));DataSize = readFile("RFID.txt", UserData);
if (!DataSize) {
printf("File <%s> NOT FOUND or EMPTY\n", "RFID.txt");
return 1;
}tcpSendBcmMessageOnce(HostAddress, (WORD)5000, (DWORD)1, (WORD)1, UserData, DataSize, &ErrorCode);
if (ErrorCode)
printf("Send Error - %s\n", tcpFormatException(Buf, ErrorCode));return 0;
}my program read and send just the first 6 ligne but the new data not ,how can i modify it to get always the new data
thanksssssssssss[cpp]
-
someone tell me that i can use seek function
how can i introduced in my programm
-
frag doch einfach auf deutsch, da haste mehr leser.
-
sorry aber ich kann nicht so gut deutsch schreiben aber ich versuche
Ich habe ein Programm geschrieben der kann nur die erst Daten aus text Datei auslesen
Aber ich bekomme immer neu Daten in meine text und das Programm sollte nur die neu Daten auslesen dann schicken
Ein jemand hatte mir gesagt ich soll seek Funktion benetzen aber ich weiß nicht wie kann ich in meinem Programm implementieren
Hatte ein jemand einer Idee wie Mann machen kann
Danke