|
Постоянный
Регистрация: 13.02.2007
Сообщений: 406
Провел на форуме: 2706059
Репутация:
206
|
|
подскажите плз в чём прикол последняя строка ч ошибкой вылетает, компилирую vc++ 6;
#include "stdafx.h"
#include "winsock.h"
#include <string.h>
#include "winbase.h"
#include <stdlib.h>
#include <iostream.h>
#pragma comment(lib,"ws2_32")
int main(int argc, char* argv[])
{
char *file="C://host.txt";
HANDLE filhend;
DWORD dw;
int i,j;
char *buff, *stroka;
filhend=CreateFile(file,GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
DWORD razm=GetFileSize(filhend, NULL);
buff = (char *)malloc(razm+1);
stroka = (char *)malloc(razm+1);
for(i=0;i<=razm;i++) {stroka[i]='\0'; buff[i]='\0';}
//DWORD razm=GetFileSize(filhend, NULL);
//cout << razm;
ReadFile(filhend, buff, razm/*127*/, &dw, 0 );
CloseHandle(filhend);
MessageBox(0,buff,"123",MB_OK);
i=0; j=0;
while(j<=razm){
while((buff[j]!=0x0D) || (j>=razm))
{
stroka[i]=buff[j];
j++; i++;
}
MessageBox(0,stroka,"123",MB_OK);
//for(int k=0;k<=j;k++) stroka[k]='\0';
j=j+2; i=0;
//if (buff[i]='!') {break;}
}
//CloseHandle(filhend);
return 0;
}
=================
разобрался
Последний раз редактировалось SVAROG; 27.06.2008 в 22:02..
|