|
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include <stdio.h>
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::NMUDP1DataReceived(TComponent *Sender,
int NumberBytes, AnsiString FromIP)
{
char buff[100];
int i;
double x,y,z;
memset(buff, 0x00, 100);
NMUDP1->ReadBuffer(buff,NumberBytes,i) ;
Edit1->ClearSelection();
Edit1->SetSelTextBuf(buff);
gets(str,"%lf %lf %lf\n", &x,&y,&z);
}
//-----------------------------------------------
제가 UDP의 데이타 리시브 에서 만든 건데요 왜 123 456 678로 보내 버퍼가 스페이스바
단위로 잘라져서 들어 가지 못하나요?
[C++ Error] Unit1.cpp(30): E2034 Cannot convert 'AnsiString' to 'char *'.
[C++ Error] Unit1.cpp(30): E2343 Type mismatch in parameter '__s' in call to 'gets(char *)'.
[C++ Error] Unit1.cpp(30): E2227 Extra parameter in call to gets(char *).
등의 에러가 떳습니다.
안시스트링을 double로 바꾸고 스페이스바 단위로 저장하구 싶습니다.
|