LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Fastest method for file writes

Hello... I am trying to determine the FASTEST method of writing string/int data to a file. I am currently using the following types of command: WriteFile(LOGFILE,"8000.......... ",15); sprintf(strout,"%i", LED_8000); WriteFile(LOGFILE,strout,strlen(strout)); WriteFile(LOGFILE,"\n",1); I have searched the forums, etc., but found nothing about the speed/efficiency of various file writing techniques. Thanks in advance for any help/suggestions.
0 Kudos
Message 1 of 5
(3,398 Views)

Hello Gromit,

 

Are you seeing any performance issues? WriteFile is one of the basic functions so it should be very speedy.

 

As with any general programming question though, a lot depends on your code and your system.

 

Please let me know if you have any specific questions or are seeing some performance issues we can try and work out.

With warm regards,

David D.
0 Kudos
Message 2 of 5
(3,363 Views)

Gromit,

 

I would recommend trying just the fopen, fprintf, and fclose functions and see if that helps. Quite some time ago we settled on that for speed reasons, and they may well hold true today.

 

--Ian

0 Kudos
Message 3 of 5
(3,359 Views)
Hello,

Thanks for the replies guys...

I am using the WriteFile function to log data returned from a USB device. The procedure loops, every 100mS, while I must acquire the data, post-process it, and log it to a file. The worst case log data is approx. 60 lines of string format.

Currently the logging and processing are within the 100mS time limit. I am worried that if they breach the 100mS barrier, using a physical memory scheme to store/retrieve data would be necessary. I have thoroughly investigated this scenario, but have found problems there also, but that's another story.




0 Kudos
Message 4 of 5
(3,316 Views)

Hello Gromit,

 

As Ian mentioned, you can definitely use the native ANSI C functions (fopen, fprintf, fclose). Aside from that, if you still have performance issues you will need to use queues or buffered acquisition.

With warm regards,

David D.
0 Kudos
Message 5 of 5
(3,307 Views)