how to reads two files at the same time : c++
This is a discussion on how to reads two files at the same time within the c++ forums in Programming Languages category; I have to to do an application with accelerometers,inside a loop while(1) I need to read 2 files each file contains the actual information of an accelerometer, I think there is a method that is better than open the first and read its information, then close it, and open the seconde and read it and then close it and return to the first .... This method is very slow, is there a better method??...
| c++ comp.lang.c++ usenet archive |
![]() |
| | LinkBack | Thread Tools |
|
#1
| |||
| |||
| This method is very slow, is there a better method?? |
|
#2
| |||
| |||
| Use fgetpos() and fsetpos(), which are designed for use with huge files. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 #include <stdio.h> int main() { int c; fpos_t pos; FILE* f = fopen( "myfile", "r+b" ); while (true) { fgetpos( f, &pos ); c = fgetc( f ); if (c == EOF) break; c = encrypt( c ); fsetpos( f, &pos ); fputc( c, f ); } fclose( f ); return 0; } That should definitely work... Thanks and Regards Rebecca Phillips |
![]() |
« Previous Thread
|
Next Thread »
| Thread Tools | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Re: PS3 droplet called from command line inXP reads in files but does not execute action | usenet | Adobe Photoshop | 0 | 09-09-2008 02:25 PM |
| Re: PS3 droplet called from command line inXP reads in files but does not execute action | usenet | Adobe Photoshop | 0 | 09-09-2008 01:46 PM |
| Re: PS3 droplet called from command line inXP reads in files but does not execute action | usenet | Adobe Photoshop | 0 | 09-09-2008 08:15 AM |
| Nonrepeatable Reads and Phantom Reads | usenet | Weblogic | 3 | 10-27-2006 05:38 AM |
| Service that Reads/Writes Files/SQL Server | usenet | DOTNET | 1 | 04-16-2004 10:59 AM |
All times are GMT -5. The time now is 08:42 AM.


