06-11-2014 07:58 AM
Hi guys,
I have an easy Q. hope u could help me :
I have a text box in my uir file, that im tring to read from.
I want the user to be able to write multiple lines - but i want it in one line in one string.
I want it to be one cell in my csv file.
Tried few things - with out any success yet.
Now i meneged to write it in to a string that has few lines meanning it hops a line when i try to write it in to a csv file.
Thought i could loop it wiht while loop to find and erase the "\n"- didnt work.
thanks in advance.
Adi.
06-11-2014 08:30 AM - edited 06-11-2014 08:32 AM
So basically you want to replace all newline characters with spaces or something else before wtiting the string to a file.
Then you can do the following:
#include <ansi_c.h> static char msg[64]; static int i; strcpy (msg, "123456\n123456\n123456\n456456"); // Dummy content to test the code while ((i = strcspn (msg, "\n")) < strlen (msg)) msg[i] = 32;
Above code can be pasted into the Interactive Execution window in order to test it. It replaces newline with spaces: if you want another character, then replace '32' value with the appropriate code or letter (e.g. '*' - note the single quotes)
06-12-2014 09:36 AM
Works !!