04-05-2018 08:40 AM - edited 04-05-2018 08:40 AM
I want to know if thanks to a function, we can get a caractere at a specific place in a line.
For exemple, I have the line :
a,z,q,1,2,4
I want to get the caractere at the 3rd place, it's 'q'.
I have created this function :
char* getValue(char* res, int numArg) { int lengthRes; char *line = NULL; int lengthLine; GetTextBoxLineLength (panelHandle, PANEL_LIGNE, 0, &lengthLine); line = malloc(sizeof(char) * (lengthLine +1)); //alloue une partie de la mémoire pour la chaine de caractères GetTextBoxLine (panelHandle, PANEL_LIGNE, 0, line); //We get what we have in PANEL_LINE //We 'parse', then we have "\n" instead of "," for (int i = 0; i< strlen(line); i++) { if(line[i] == ',') { line[i]='\n'; } } //all comma in 'line' are replaced by \n ResetTextBox (panelHandle, PANEL_PARSE, line); //We display 'line' after replaced commas, we will have several lines GetTextBoxLineLength (panelHandle, PANEL_PARSE, numArg-1, &lengthRes); res = malloc(sizeof(char) * (lengthRes +1)); //alloue une partie de la mémoire pour la chaine de caractères GetTextBoxLine (panelHandle, PANEL_PARSE, numArg-1, res); //The value of "res" correspond to "numArg"ieme line of 'line', so at "numArg"ieme field return res; //We return "res", that the value we were wanted to have }
But, when I have many lines to analyse, it take a lot of time, because of th rewritting in the Box etc...
Can you help me please ?
04-10-2018 03:21 AM
Bonjour Zerged
Ce post est un peu différent mais il peut vous aider à résoudre votre problème : https://forums.ni.com/t5/LabWindows-CVI/comma-separated-string-showing-on-table-colum/td-p/323185