As title, a serial port is already written, interface as shown in figure, can select the command to open a TXT file and display, this section function has been implemented,
A rookie, your guidance,
CodePudding user response:
You mean you want to know how to read out from the inside of the ini file you cstrings cycle to a serial port? Did you read it can display in the Edit, sealed and serial port, it is not cstrings converting a variable type? You ask is what mean?
CodePudding user response:
On the Internet to look for a serial port class USES
CodePudding user response:
Did read TXT file content, convert Hex format, thrown into a serial port, finished
CStdioFile classes did read the text
CodePudding user response:
What will you do if the cycle, can be to add this in your configuration file:
[COMMAND_TEST]
CMD_TOTAL=n
CMD1=...
CMD2=...
CMD3=...
.
CMDn=...
Then put n also read out
# define CMDSIZE 512
Cstrings strConfig;
Cstrings strFileName;
Int nLen=GetPrivateProfileString (" COMMAND_TEST ", "CMD_TOTAL", NULL, strConfig. GetBuffer (CMDSIZE), CMDSIZE, strFileName);
StrConfig. ReleaseBuffer ();
If (nLen & lt; 0)
{
LogInfo (" Read Command_TEST. Ini: TOTAL Failed, both Please Check the Config File!" , RED);
return;
}
Int nTotalNumber=atoi (strConfig);//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- the Command Amount
For (int nIndex=0; NIndex
{
One writes a serial port;
}
CodePudding user response:
reference 1st floor Janxionwang response: are you saying you want to know how to read out from the inside of the ini file you cstrings cycle to a serial port? Did you read it can display in the Edit, sealed and serial port, it is not cstrings converting a variable type? You ask is what mean? As shown in figure, I am a serial port is already written, receiving can be, I just want to point selection instruction (instruction TXT file exists, one line) button, display on the sending box (line), then click start sending also line after sent out, later I want to add timers, CodePudding user response:
Send a box with listctr controls, and read each line TXT it endures controls the corresponding line, sent from the control of the first line to send, so I can? CodePudding user response:
refer to 6th floor shuaigetuimaochang response: Quote: refer to 1st floor Janxionwang response: You mean you want to know how to read out from the inside of the ini file you cstrings cycle to a serial port? Did you read it can display in the Edit, sealed and serial port, it is not cstrings converting a variable type? You ask is what mean? As shown in figure, I am a serial port is already written, receiving can be, I just want to point selection instruction (instruction TXT file exists, one line) button, display on the sending box (line), then click start sending also line after sent out, later I want to add timers, refer to 6th floor shuaigetuimaochang response: Quote: refer to 1st floor Janxionwang response: You mean you want to know how to read out from the inside of the ini file you cstrings cycle to a serial port? Did you read it can display in the Edit, sealed and serial port, it is not cstrings converting a variable type? You ask is what mean? As shown in figure, I am a serial port is already written, receiving can be, I just want to point selection instruction (instruction TXT file exists, one line) button, display on the sending box (line), then click start sending also line after sent out, later I want to add timers, Can according to the 7th floor suggested changing the display of control to ListControl; You can also continue to use the Edit, in accordance with the method of I give you a reply on the 4th floor to write configuration files, thinking twice cycle: 1. Click on the select files: loop reads a string from the config file and display to the Edit window, pay attention to in the end of the string, read \ r \ n achieve a newline; 2. Click on the send: loop reads a string from the config file and sent to a serial port. CodePudding user response:
refer to 7th floor a393062456 response: send box with listctr controls, and read each line TXT it endures controls the corresponding line, sent from the control of the first line to send, so I can? Can't use the list, can only use the array, rookie, I just start is not very will use an array, is from TXT read a line and then send a timer, I now all functions are realized, just that, a great god can grant instruction, detailed point of the forehead is best, thank you very much CodePudding user response:
An array? A string array? You save refers to read a line to a string array elements inside, so can also ah, do a loop, it is ok to sent to the inside of the array elements cycle CodePudding user response:
The references to the tenth floor a393062456 response: array? A string array? You save refers to read a line to a string array elements inside, so can also ah, do a loop, it is ok to sent to the inside of the array elements cycle. To to the rightness, is this meaning, I got a half-day or not, I don't know write data line array should be how to write, Such as TXT file: 234 4 ge HHF Could you detail, it is not really wrote, thank you very much, CodePudding user response:
Getline circulation in reading TXT file, read, you this in the vector is better, because you never know how much inside file, use vector , Each read a line is added into the vector, until the end of the read, when send to iterate over the vector hair good, nature of the vector is a dynamic array CodePudding user response:
refer to 12 floor a393062456 reply: reading TXT file, read with getline circulation, you this in the vector is better, because you never know how much inside file, use vector , Each read a line is added into the vector, until the end of the read, when send to iterate over the vector hair good, nature of the vector is a dynamic array Answer: hello, thank you very much, but I'm still a bit not clear the use of array, DLG. H: Cstrings a1 [], a2 [], a3 []; DLG. CPP in: Getline (myfile STRM, '\ n') A1 []=strem; I can only think of so much now, I don't know how to read each line into the corresponding array, beginners can't understand, hope you can be glad, thank you very much! CodePudding user response:
String buff. Int n=0; Ifstream infile. Infile. Open (" do you want to open the file name. TXT "); if(! Infile) return; While (getline (infile, buff)) { A, [n++]=buff. } CodePudding user response:
Use the code above you want to make sure you have enough storage space array, otherwise it is better to the vector CodePudding user response:
Read hair hair read hair... CodePudding user response:
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull