need help with ReadFile need to read in from : to -
Code:
#include "stdafx.h"
#include "windows.h"
#include <iostream>
using namespace std;
HANDLE File;
char Buf[128];
char lpbuffer[128];
DWORD dwRead;
int found = 0;
int spaces = 0;
int j = 0;
void check();
void Makeip();
//: 219.128.254.40 -
int _tmain(int argc, _TCHAR* argv[])
{
Buf[127] = '\0';
File = CreateFile("file.txt",GENERIC_READ, 0, NULL ,OPEN_ALWAYS , FILE_ATTRIBUTE_NORMAL , NULL);
while(1)
{
ReadFile(File , Buf , sizeof(Buf), &dwRead , NULL);
for(int i = 0; i < sizeof(Buf); i++) //checks through the lenght of the buffer
{
if(Buf[i] == ':') //theres 2 of these , the txt where i want is after the second :
{
found++;
if(found == 2)
{
//now the text i want to get from the buffer is between : and - but sometimes is in a diferent place on diferent lines so the Buffer array element wont always be in there...
}
}
}
}
return 0;
}