20.12.2010, 13:04
Isto deve resolver o seu problema:
Espero ter ajudado
pawn Код:
public CheckConnectionWithTool(tentativas)
{
for(new i=0; i<tentativas; i++)
{
new string[256]; // Create the string to store the read text in
new File: file = fopen("sampsc/socket.com", io_read); // Open the file
if (file)
{
// Le o Comando
fread(file, string); // Fread from the file and store what's read in 'string'
fclose(file); // Close the file
new command[256];
format(command, sizeof(command),"%s",string);
if(strcmp(command,"CHECKSTATUS",true)==0) //Strcmp para comparar strings
{
// Envia o Status da COM
new strfile[256];
format(strfile, sizeof(strfile),"SDKOK_RESP001");
new File: file2 = fopen("sampsc/socket.resp", io_write); // Open the file
if (file2)
{
fremove("sampsc/socket.resp");
}
fwrite(file2, strfile);
fclose(file2);
}
}
return 1;
}
return 0;
}
Espero ter ajudado
