HI,
Ive got a txt file with 120 lines in it, basically all i want to do is read through each line in it (looping around) and once in that line position, check to see if it contains an "R", if it does then i want to do something!
Ive had a go at doing this, as you can see from the code below. But got an error, also shown below! Please try and help in any way you can!
Code://Automatic Reset int CountDown[120]; int A; char Buf[1]; long Dist; int NumRead; char Blank[2] = " "; while (TRUE) { Sleep(100); for ( A = 1; (A >= 1) && (A <= 120); A++) { Dist=(6 + ((A - 1) * 9)); pnHandle = fopen(gtRESET_FILE, "r+"); pnSize = fseek(pnHandle, Dist, SEEK_SET); NumRead = fread(Buf, 1, 1, pnHandle); if (Buf == "R") { CountDown[A] = 300; //Do Block Here, Somehow??! iPutEvent(A, GCEV_BLOCKED); fwrite(Blank, 1, 1, pnHandle); } CountDown[A]--; if (CountDown[A] = 0) { //Do UnBlock Here, Somehow??! iPutEvent(A, GCEV_UNBLOCKED); } } }
Error
-------------
Compiling...
EventHandler.cpp
C:\SMS\sms_c_V4\EventHandler.cpp(1121) : warning C4101: 'itemp' : unreferenced local variable
C:\SMS\sms_c_V4\EventHandler.cpp(1637) : error C2440: '=' : cannot convert from 'int' to 'struct _iobuf *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.
EventHandler.obj - 1 error(s), 1 warning(s)
----------------
Thanks for any help whatsoever,
P![]()



LinkBack URL
About LinkBacks



