473,237 Members | 1,094 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,237 software developers and data experts.

File contains only or mainly zero

I've got a problem with an embedded PC which generates corrupted files during a shutdown-boot cycle. The corrupted files contain the correct (estimated) number of bytes, but all bytes have a zero value. To make the problem more interesting this occurs sometimes (after 1 cycle or after 30 cycles), and when it happens it can be possible that only the last number of bytes of the file contain zero's. Shutdown means that the power is shut down on the complete machine, thus stopping the PC immdiately. There's no way of forcing the OS to start a shutdown process.

System used:
Embedded PIV platform based on Intel 845GV chipset.
Harddisk: Maxtor Fireball 3 or Diamonmax Plus 8 (40Gb). Microsoft XP embedded, EWF using RAM overlay on c: partition. Corrupted files are created on NTFS non-EWF d: partition.

File handling code (c++):

m_hFile = CreateFile( fname,
GENERIC_WRITE | GENERIC_READ,
0,
&sa,
OPEN_ALWAYS,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_WRITE_THROUGH | FILE_FLAG_RANDOM_ACCESS ,
NULL);

if (m_hFile)
{
//doing stuff...

FlushFileBuffers(m_hFile);
CloseHandle(m_hFile);
}

And on the same file(s), not at the same time:

fp = fopen(fname,"rt");

if (fp)
{
//doing stuff...

fflush(fp);
fclose(fp);
}

I suspect that some kind of buffer failed to write (all) bytes to an already prepared file. This explains the number of bytes being zero. If this is an OS buffer, a filesystem buffer or a hardware buffer is unclear to me. Does one of you have experienced the same problem, or got any idea on how I can solve this problem? "

===
Afsluiting :) :
"
Thanks in advance,

Greetings from your big friend from The Netherlands, "
Jul 21 '06 #1
0 1183

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: aa | last post by:
I am trying to read a.php file from another PHP file using fgets() and display its contents. As a.php starts with <? the browser IE6 does not show anything, although I can see all the contents in...
1
by: jase_dukerider | last post by:
Hi I have an assignment to hand in shortly for which I am after some guidance. The task is to read a WAV file, request a fade in /out time for the track from the user and the do the fade by...
1
by: Joshua Ammann | last post by:
Hello, I'm trying to export a query containing contact information, including a field. Some zip codes have one or two leading zeros, for example, San Juan, PR (00927) and Springfield, MA...
3
by: comp_novice | last post by:
I need to control the number of digits to be printed after the exponential. Please have a look at the example below: float fVal = 0.06854344 The printf that I am using is fprintf(pfile,...
0
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
14
by: prasadjoshi124 | last post by:
Hi All, I am writing a small tool which is supposed to fill the filesystem to a specified percent. For, that I need to read how much the file system is full in percent, like the output given...
7
by: Ympostor | last post by:
Hello. Is there a method in the .NET class libraries to know if a given file is binary or just plain text (ASCII)? Thanks in advance. --
27
by: Jeff | last post by:
Im trying to figure out why I cant read back a binary file correctly. I have the following union: #define BITE_RECORD_LEN 12 typedef union { unsigned char byte; struct { unsigned char type;...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.