konvertering af c++ program til embedded c++
Hej!Jeg ønsker at få konveret følgende program til embedded C++!
men jeg er lidt på bar bund, nogen som vil hjælpe!
Mine problemer er omkring
#include "fstream"
#include <iostream>
#include "windows.h"
#include <string>
resten af programmet er nogenlunde ligetil:
using namespace std;
int filereading(char * filenameIn, char * filenameOut, char * charToSplit)
{
ifstream fIn;
ifstream *pfIn;
fstream fOut;
fstream *pfOut;
pfOut = &fOut;
pfIn = &fIn;
fOut.open(filenameOut, fstream::out, fstream::app);
fIn.open(filenameIn, fstream::in);
string buffer = "";
string oldbuffer = "";
int tmp = 0;
int counter = 0;
if(fIn.is_open())
{
while(!fIn.eof())
{
getline(fIn, buffer);
buffer = &buffer[strcspn(buffer.c_str(), charToSplit) + 1];
if(tmp == 0)
{
tmp = (int)strcspn(buffer.c_str(), charToSplit);
}
if(strncmp((char*)buffer.c_str(), oldbuffer.c_str(), tmp) != 0)
{
if(counter != 0)
*pfOut << oldbuffer.c_str() << "," << counter << endl;
strncpy((char*)oldbuffer.c_str(), buffer.c_str(), tmp);
counter = 1;
if(oldbuffer.length() != tmp)
oldbuffer[tmp] = 0;
}
else
{
counter++;
cout << buffer << counter << endl;
}
}
}
fIn.clear();
fIn.close();
fOut.close();
fOut.clear();
return 0;
}
int _tmain(int argc, _TCHAR* argv[])
{
filereading(argv[1], argv[2], argv[3]);
return 0;
}