各位大侠小弟有一问题想问大家,就是我实时的数据想保存到文本文档中,现在有一个问题。
就是每次程序重新启动后,发现数据都不换行,而是覆盖了以前的数据。如何才能换行,保存所有的数据。代码如下:
         static  char *p = new char[20];
static  char *p1 = new char[20];
static  char *p2 = new char[20];
static  DWORD dwWrites;
static  DWORD dwWrites1;
static  DWORD dwWrites2; 
hFile=CreateFile("E:\\abc.txt",GENERIC_READ | GENERIC_WRITE,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);//
m_width=a/100;
sprintf(p, "%.2f\x20", m_width);
WriteFile(hFile, p, strlen(p), &dwWrites,NULL);
m_height1=b/100;
sprintf(p1, "%.2f\x20", m_height1);
WriteFile(hFile, p1, strlen(p1), &dwWrites1,NULL);
m_height2=c/10
sprintf(p2, "%.2f\r\n", m_height2);
WriteFile(hFile, p2, strlen(p2), &dwWrites2,NULL);