 newbieeng
		
			newbieeng
		
		
		
		
		
		
		
		
	
			02-27-2013 05:20 AM
I was trying to code a vi that is capable of writing a text log file whose name includes the date and time, but it does not create text file and create error 1430. When I deleted format date/time string function and wired the name of the file directly to the open file function, it worked without errors. What is wronh here?
Solved! Go to Solution.
 .aCe.
		
			.aCe.
		
		
		 
		
		
		
		
		
	
			02-27-2013 05:27 AM
Its because you have "/" in your date (for example 27/02/2013). Windows wont allow that. Replace that with some other allowed character and you will be fine.
02-27-2013 05:41 AM - edited 02-27-2013 05:43 AM
I checked its result and it does not write "/", it uses dot in indicator (27.02.2013) in date. Oh ok, I recognize that it uses semicolon while writing time. How could I change it?
 .aCe.
		
			.aCe.
		
		
		 
		
		
		
		
		
	
			02-27-2013 05:51 AM - edited 02-27-2013 05:51 AM
Then it will be the ":" in the time stamp. It is not a good idea to do this without using proper formats, as %c displays local-specific time stamp. So if it is used elsewhere or if someone changes the system settings, your code will error. So you may want to specify a proper format which will remain constant instead of %c
Also use close file http://zone.ni.com/reference/en-XX/help/371361J-01/glang/close_file/ after you have written to it to close the reference you opened. This is good practice.
 crossrulz
		
			crossrulz
		
		
		 
		
		
		
		
		
	
			02-27-2013 05:57 AM - edited 02-27-2013 05:58 AM
I tend to format my data/times for a file something like this:

02-27-2013 06:41 AM
Thank you Crossrulz. I got it.