LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Save string at the end of file

Hello,
I have a string , and I want save this string of the end of my file.
The problem is, that CVI save my string at the end of the last line, not i a new line.
Here you can see the correct saves:

03-02-1997 13:56:37 1 1 0 0.0000 3
03-02-1997 13:59:35 1 1 0 0.0000 3
03-02-1997 14:26:01 1 1 0 0.0000 2

But my Function looks like this:

03-02-1997 13:56:37 1 1 0 0.0000 3 03-02-1997 13:56:37 1 1 0 0.0000 3 03-02-1997 13:56:37 1 1 0 0.0000 3


You can see, that my program did not start in a new line!!!
Can s.B. help my please?
"/n" did not gone.

Thanks
0 Kudos
Message 1 of 7
(3,815 Views)
It will work better with "\n" instead of "/n"

🐵
Message 2 of 7
(3,806 Views)
/n does work.
Can you post the section of code that writes to the file?
How are you viewing the file when you see the appended line instead of the new line?
Have you looked at the file using a hex viewer or the DOS Debug program to see what character separates one line from the next?
0 Kudos
Message 3 of 7
(3,807 Views)
oops!
Thanks Rac!
0 Kudos
Message 4 of 7
(3,801 Views)
Please look to my code:
void PruefdatenSpeichern(void)
{
input2 = fopen (file, "a");

strcpy (w, p); //p = the string with my system time
strcpy (message5, "/n"); // /n as a string
strcat(w , message5); //add /n to the and of my string
fputs (w, input2); //write into my file

fclose (input2); //close file
}

This code did not write in a new line!
The write code was edit by me with the editor!!!

I looked at the file with the Microsoft Editor.
Can you help me, what I do wrong?

Tanks
0 Kudos
Message 5 of 7
(3,796 Views)
As allready posted, if you are able to read:

Use "\n" instead of "/n" !!!!!!!

!!!!
0 Kudos
Message 6 of 7
(3,788 Views)
Ohhhhh! Sorry it was my mistake!!!

Thanks
0 Kudos
Message 7 of 7
(3,786 Views)