BCB如何将文本中的数据写入到txt文件中
HANDLE hFile = ::CreateFile("D:\\3.txt",
GENERIC_WRITE,
FILE_SHARE_WRITE,
NULL,
OPEN_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL);
String ee;
ee=Edit3->Text;
int j=ee.Length();
Edit4->Text=j;
double a=ee.ToDouble();
char sz[20] = { 0 };
DWORD dwWrites;
sprintf(sz, "%.2f\r\n", a);
WriteFile(hFile, sz, strlen(sz), &dwWrites, NULL);
::CloseHandle(hFile);
从网上下的,不太会用,打开txt里面显示的不对,是0.00,不知道该怎么解决
[解决办法]
sz没有赋值
strcpy(sz,"Your Text");