473,623 Members | 2,447 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Crashing with cstdio file class

I'm fairly new to doing involved file i/o and I came across something
weird with a program I'm writing (modifying MIDI data, if it makes any
difference). With some input files, when I modify data and then output
to a new file, the program will crash. The catch is that when I open up
the output file to see what the program managed to write, it always
makes it to an offset of xFFF.

For example, with one file it crashed at 2FFF, another at 1FFF, and
another at 6FFF. The actual data at those addresses have no connection
to one another, so I can't really find a pattern. I'm wondering if
there's some exception to file writing with cstdio that would cause
something like this.

Thanks.
Oct 2 '05 #1
5 2279
Ian
John Douglass wrote:
I'm fairly new to doing involved file i/o and I came across something
weird with a program I'm writing (modifying MIDI data, if it makes any
difference). With some input files, when I modify data and then output
to a new file, the program will crash. The catch is that when I open up
the output file to see what the program managed to write, it always
makes it to an offset of xFFF.

Could be the offset is a multiple of a buffer size, more detail required
for anyone to help, post some code.

Ian
Oct 2 '05 #2
Ian wrote:
John Douglass wrote:
I'm fairly new to doing involved file i/o and I came across something
weird with a program I'm writing (modifying MIDI data, if it makes any
difference). With some input files, when I modify data and then output
to a new file, the program will crash. The catch is that when I open
up the output file to see what the program managed to write, it always
makes it to an offset of xFFF.

Could be the offset is a multiple of a buffer size, more detail required
for anyone to help, post some code.

Ian


Okay, here is the main bulk of the code:
FILE * pInFile;
FILE * pOutFile;

pInFile = fopen(s_inFile, "rb");
pOutFile = fopen(s_outFile , "wb");

// bool flags
bool bFlag = 0;

do {
// read a byte
dwRead = fread(&szBuffer[0], 1, 1, pInFile);

// if we have a note-on status message
if (szBuffer[0] == szNoteOn[0]) {
// write the byte
fwrite(&szBuffe r[0], 1, dwRead, pOutFile);

// prepare for while loop
bFlag = 0;

// deal with notes marked after note_on message
do {
// convert note
dwRead = fread(&szBuffer[0], 1, 1, pInFile);
gmToDKFH(&szBuf fer[0]);
fwrite(&szBuffe r[0], 1, dwRead, pOutFile);

// convert velocity
dwRead = fread(&szBuffer[0], 1, 1, pInFile);

// if velocity is >= 95
if (strcmp(&szBuff er[0], &szVelTarget[0]) >= 0) {
// if we're not going to change the hihats later, or this isn't a hihat
if ((!b_useHihat) || (strcmp(&szBuff er[0], &szOpenHat[0])) &&
(strcmp(&szBuff er[0], &szClosedHat[0]))) {
// set new velocity
szBuffer[0] = (char) 0x7f;
}
}

// write the velocity
fwrite(&szBuffe r[0], 1, dwRead, pOutFile);

// if the next byte is a null, write and go back through the loop
// if the next byte is a all notes off status message, write and
exit the loop
dwRead = fread(&szBuffer[0], 1, 1, pInFile);

if (szBuffer[0] == szAllNotesOff[0]) {
bFlag = 1;
}
fwrite(&szBuffe r[0], 1, dwRead, pOutFile);
}
while (!bFlag);

// the next byte should be a note_off status message (0x89)
dwRead = fread(&szBuffer[0], 1, 1, pInFile);
fwrite(&szBuffe r[0], 1, dwRead, pOutFile);

// prepare for while loop
bFlag = 0;

// deal with note messages after status message
do {
// convert note and write
dwRead = fread(&szBuffer[0], 1, 1, pInFile);
gmToDKFH(&szBuf fer[0]);
fwrite(&szBuffe r[0], 1, dwRead, pOutFile);

// convert velocity
dwRead = fread(&szBuffer[0], 1, 1, pInFile);

// if velocity is >= 80
if (strcmp(&szBuff er[0], &szVelTarget Off[0]) >= 0) {
// if we're not going to change the hihats later, or this isn't a hihat
if ((!b_useHihat) || (strcmp(&szBuff er[0], &szOpenHat[0])) &&
(strcmp(&szBuff er[0], &szClosedHat[0]))) {
// set new velocity
szBuffer[0] = (char) 0x7f;
}
}
// write velocity
fwrite(&szBuffe r[0], 1, dwRead, pOutFile);

// this byte should be a null, so write it
dwRead = fread(&szBuffer[0], 1, 1, pInFile);
fwrite(&szBuffe r[0], 1, dwRead, pOutFile);

// if we're back at a note_on message, exit loop and push the byte
back into the stream
// if we're at a 0xFF message, we're almost at the end of the file,
so write the byte and exit the loop
// otherwise, push the byte back into the stream and go through the
loop again
dwRead = fread(&szBuffer[0], 1, 1, pInFile);

if (szBuffer[0] == szNoteOn[0]) {
bFlag = 1;
ungetc(szBuffer[0], pInFile);
}
else if (szBuffer[0] == szEOFMarker[0]) {
bFlag = 1;
fwrite(&szBuffe r[0], 1, dwRead, pOutFile);
ungetc(szBuffer[0], pInFile);
}
else {
ungetc(szBuffer[0], pInFile);
}
}
while (!bFlag);
}
// if we don't have a note-on, go back through the loop
else {
fwrite(&szBuffe r[0], 1, dwRead, pOutFile);
}
}
// exit when we get to the end of the file
while (dwRead > 0);

fclose(pInFile) ;
fclose(pOutFile );

--------------------

the "gmToDKFH() " function just takes a byte from the buffer and changes
it according to the midi standard I'm converting to.

Here are some of the relevent strings/chars I'm comparing in the program:

// bytes read
size_t dwRead;

// single char file buffer
char szBuffer[2];
szBuffer[1] = 0x00;

// constants
char szNoteOn[2];
sprintf(&szNote On[0], "%c", 0x99);
szNoteOn[1] = 0x00;

char szNoteOnMin[2];
sprintf(&szNote OnMin[0], "%c", MIDI_CMD_NOTE_O N);
szNoteOnMin[1] = 0x00;

char szNoteOnMax[2];
sprintf(&szNote OnMax[0], "%c", 0x9F);
szNoteOnMax[1] = 0x00;

char szNoteOffMin[2];
sprintf(&szNote OffMin[0], "%c", MIDI_CMD_NOTE_O FF);
szNoteOffMin[1] = 0x00;

char szNoteOffMax[2];
sprintf(&szNote OffMax[0], "%c", 0x8F);
szNoteOffMax[1] = 0x00;

char szAllNotesOff[2];
sprintf(&szAllN otesOff[0], "%c", MIDI_CTL_ALL_SO UNDS_OFF);
szAllNotesOff[1] = 0x00;

// velocity 95
char szVelTarget[2];
sprintf(&szVelT arget[0], "%c", 0x5f);
szVelTarget[1] = 0x00;

char szVelTargetOff[2];
sprintf(&szVelT argetOff[0], "%c", 0x50);
szVelTargetOff[1] = 0x00;

// hihat constants
char szOpenHat[2];
sprintf(&szOpen Hat[0], "%c", 0x43);
szOpenHat[1] = 0x00;

char szClosedHat[2];
sprintf(&szClos edHat[0], "%c", 0x3e);
szClosedHat[1] = 0x00;

// 0xFF eof marker for midi
char szEOFMarker[2];
sprintf(&szEOFM arker[0], "%c", 0xff);
szEOFMarker[1] = 0x00;

// null target
char szNull[2];
sprintf(&szNull[0], "%c", 0x00);
szNull[1] = 0x00;

-------------------

If any explanation or further code is needed, I'd be happy to provide.

Thanks
Oct 2 '05 #3

John Douglass wrote:
Ian wrote:
John Douglass wrote:
I'm fairly new to doing involved file i/o and I came across something
weird with a program I'm writing (modifying MIDI data, if it makes any
difference). With some input files, when I modify data and then output
to a new file, the program will crash. The catch is that when I open
up the output file to see what the program managed to write, it always
makes it to an offset of xFFF.

Could be the offset is a multiple of a buffer size, more detail required
for anyone to help, post some code.

Ian


Okay, here is the main bulk of the code:
FILE * pInFile;
FILE * pOutFile;

pInFile = fopen(s_inFile, "rb");
pOutFile = fopen(s_outFile , "wb");

// bool flags
bool bFlag = 0;

do {
// read a byte
dwRead = fread(&szBuffer[0], 1, 1, pInFile);

// if we have a note-on status message
if (szBuffer[0] == szNoteOn[0]) {
// write the byte
fwrite(&szBuffe r[0], 1, dwRead, pOutFile);

// prepare for while loop
bFlag = 0;

// deal with notes marked after note_on message
do {
// convert note
dwRead = fread(&szBuffer[0], 1, 1, pInFile);
gmToDKFH(&szBuf fer[0]);
fwrite(&szBuffe r[0], 1, dwRead, pOutFile);

// convert velocity
dwRead = fread(&szBuffer[0], 1, 1, pInFile);

// if velocity is >= 95
if (strcmp(&szBuff er[0], &szVelTarget[0]) >= 0) {
// if we're not going to change the hihats later, or this isn't a hihat
if ((!b_useHihat) || (strcmp(&szBuff er[0], &szOpenHat[0])) &&
(strcmp(&szBuff er[0], &szClosedHat[0]))) {
// set new velocity
szBuffer[0] = (char) 0x7f;
}
}

// write the velocity
fwrite(&szBuffe r[0], 1, dwRead, pOutFile);

// if the next byte is a null, write and go back through the loop
// if the next byte is a all notes off status message, write and
exit the loop
dwRead = fread(&szBuffer[0], 1, 1, pInFile);

if (szBuffer[0] == szAllNotesOff[0]) {
bFlag = 1;
}
fwrite(&szBuffe r[0], 1, dwRead, pOutFile);
}
while (!bFlag);

// the next byte should be a note_off status message (0x89)
dwRead = fread(&szBuffer[0], 1, 1, pInFile);
fwrite(&szBuffe r[0], 1, dwRead, pOutFile);

// prepare for while loop
bFlag = 0;

// deal with note messages after status message
do {
// convert note and write
dwRead = fread(&szBuffer[0], 1, 1, pInFile);
gmToDKFH(&szBuf fer[0]);
fwrite(&szBuffe r[0], 1, dwRead, pOutFile);

// convert velocity
dwRead = fread(&szBuffer[0], 1, 1, pInFile);

// if velocity is >= 80
if (strcmp(&szBuff er[0], &szVelTarget Off[0]) >= 0) {
// if we're not going to change the hihats later, or this isn't a hihat
if ((!b_useHihat) || (strcmp(&szBuff er[0], &szOpenHat[0])) &&
(strcmp(&szBuff er[0], &szClosedHat[0]))) {
// set new velocity
szBuffer[0] = (char) 0x7f;
}
}
// write velocity
fwrite(&szBuffe r[0], 1, dwRead, pOutFile);

// this byte should be a null, so write it
dwRead = fread(&szBuffer[0], 1, 1, pInFile);
fwrite(&szBuffe r[0], 1, dwRead, pOutFile);

// if we're back at a note_on message, exit loop and push the byte
back into the stream
// if we're at a 0xFF message, we're almost at the end of the file,
so write the byte and exit the loop
// otherwise, push the byte back into the stream and go through the
loop again
dwRead = fread(&szBuffer[0], 1, 1, pInFile);

if (szBuffer[0] == szNoteOn[0]) {
bFlag = 1;
ungetc(szBuffer[0], pInFile);
}
else if (szBuffer[0] == szEOFMarker[0]) {
bFlag = 1;
fwrite(&szBuffe r[0], 1, dwRead, pOutFile);
ungetc(szBuffer[0], pInFile);
}
else {
ungetc(szBuffer[0], pInFile);
}
}
while (!bFlag);
}
// if we don't have a note-on, go back through the loop
else {
fwrite(&szBuffe r[0], 1, dwRead, pOutFile);
}
}
// exit when we get to the end of the file
while (dwRead > 0);

fclose(pInFile) ;
fclose(pOutFile );

--------------------

the "gmToDKFH() " function just takes a byte from the buffer and changes
it according to the midi standard I'm converting to.

Here are some of the relevent strings/chars I'm comparing in the program:

// bytes read
size_t dwRead;

// single char file buffer
char szBuffer[2];
szBuffer[1] = 0x00;

// constants
char szNoteOn[2];
sprintf(&szNote On[0], "%c", 0x99);
szNoteOn[1] = 0x00;

char szNoteOnMin[2];
sprintf(&szNote OnMin[0], "%c", MIDI_CMD_NOTE_O N);
szNoteOnMin[1] = 0x00;

char szNoteOnMax[2];
sprintf(&szNote OnMax[0], "%c", 0x9F);
szNoteOnMax[1] = 0x00;

char szNoteOffMin[2];
sprintf(&szNote OffMin[0], "%c", MIDI_CMD_NOTE_O FF);
szNoteOffMin[1] = 0x00;

char szNoteOffMax[2];
sprintf(&szNote OffMax[0], "%c", 0x8F);
szNoteOffMax[1] = 0x00;

char szAllNotesOff[2];
sprintf(&szAllN otesOff[0], "%c", MIDI_CTL_ALL_SO UNDS_OFF);
szAllNotesOff[1] = 0x00;

// velocity 95
char szVelTarget[2];
sprintf(&szVelT arget[0], "%c", 0x5f);
szVelTarget[1] = 0x00;

char szVelTargetOff[2];
sprintf(&szVelT argetOff[0], "%c", 0x50);
szVelTargetOff[1] = 0x00;

// hihat constants
char szOpenHat[2];
sprintf(&szOpen Hat[0], "%c", 0x43);
szOpenHat[1] = 0x00;

char szClosedHat[2];
sprintf(&szClos edHat[0], "%c", 0x3e);
szClosedHat[1] = 0x00;

// 0xFF eof marker for midi
char szEOFMarker[2];
sprintf(&szEOFM arker[0], "%c", 0xff);
szEOFMarker[1] = 0x00;

// null target
char szNull[2];
sprintf(&szNull[0], "%c", 0x00);
szNull[1] = 0x00;

-------------------

If any explanation or further code is needed, I'd be happy to provide.

Thanks

This is a rather bulky size of code, and it will take me an hour to
find a bug. I charge 50$/hour, but willing to make an exception, and it
will cost you $40.99. Respond if interested.

Oct 2 '05 #4
Ian
John Douglass wrote:
Ian wrote:
John Douglass wrote:
I'm fairly new to doing involved file i/o and I came across something
weird with a program I'm writing (modifying MIDI data, if it makes
any difference). With some input files, when I modify data and then
output to a new file, the program will crash. The catch is that when
I open up the output file to see what the program managed to write,
it always makes it to an offset of xFFF.

Could be the offset is a multiple of a buffer size, more detail
required for anyone to help, post some code.

Ian

Okay, here is the main bulk of the code:


What happens if fread return 0? You don't test.

How does it crash?

Think about replacing each commented bit of code with a function, it
will make things clearer.

Ian
Oct 2 '05 #5
On Sun, 02 Oct 2005 18:10:41 -0400, John Douglass
<gt*****@mail.g atech.edu> wrote in comp.lang.c++:
I haven't looked at your code in detail, and I don't know what your
particular problem is, but I thought I would point out a few things.
Ian wrote:
John Douglass wrote:
I'm fairly new to doing involved file i/o and I came across something
weird with a program I'm writing (modifying MIDI data, if it makes any
difference). With some input files, when I modify data and then output
to a new file, the program will crash. The catch is that when I open
up the output file to see what the program managed to write, it always
makes it to an offset of xFFF.
Could be the offset is a multiple of a buffer size, more detail required
for anyone to help, post some code.

Ian


Okay, here is the main bulk of the code:
FILE * pInFile;
FILE * pOutFile;

pInFile = fopen(s_inFile, "rb");
pOutFile = fopen(s_outFile , "wb");


It's a very bad idea to assume that fopen() succeeded. If it did not,
you will be passing a null pointer to other stdio functions causing
undefined behavior.

if ((pInFile = fopen(s_inFile, "rb")) == NULL)
{
/* error handling */
}
// bool flags
bool bFlag = 0;

do {
// read a byte
dwRead = fread(&szBuffer[0], 1, 1, pInFile);
Just a few comments:

The expression '&szBuffer[0]' is exactly equivalent in a function call
to 'szBuffer', assuming that 'szBuffer' is defined as an array of some
type. Each expression evaluates to the address of szBuffer[0], and
has the type pointer to whatever type szBuffer is an array of.

Also note that fgetc() and fputc() work just fine for binary files,
and are a lot more concise than fread() and fwrite(). You could
translate the line above to:

szBuffer[0] = fgetc(pInFile);

Then you can check szBuffer[0] for EOF.

// if we have a note-on status message
if (szBuffer[0] == szNoteOn[0]) {
// write the byte
fwrite(&szBuffe r[0], 1, dwRead, pOutFile);
Likewise here:

if (EOF == fputc(szBuffer[0], pOutFile)
{
/* error handling */
}
// prepare for while loop
bFlag = 0;

// deal with notes marked after note_on message
do {
// convert note
dwRead = fread(&szBuffer[0], 1, 1, pInFile);
gmToDKFH(&szBuf fer[0]);
fwrite(&szBuffe r[0], 1, dwRead, pOutFile);

// convert velocity
dwRead = fread(&szBuffer[0], 1, 1, pInFile);

// if velocity is >= 95
if (strcmp(&szBuff er[0], &szVelTarget[0]) >= 0) {
You only ever read one character into szBuffer[0]. It most certainly
is not likely to be a '\0' terminated C string, despite what you have
named it. You can't just pass any pointer to character(s) to
strcmp(), it must be a valid null terminated C string.
// if we're not going to change the hihats later, or this isn't a hihat
if ((!b_useHihat) || (strcmp(&szBuff er[0], &szOpenHat[0])) &&
(strcmp(&szBuff er[0], &szClosedHat[0]))) {
// set new velocity
szBuffer[0] = (char) 0x7f;
}
}

// write the velocity
fwrite(&szBuffe r[0], 1, dwRead, pOutFile);

// if the next byte is a null, write and go back through the loop
// if the next byte is a all notes off status message, write and
exit the loop
dwRead = fread(&szBuffer[0], 1, 1, pInFile);

if (szBuffer[0] == szAllNotesOff[0]) {
bFlag = 1;
}
fwrite(&szBuffe r[0], 1, dwRead, pOutFile);
}
while (!bFlag);

// the next byte should be a note_off status message (0x89)
dwRead = fread(&szBuffer[0], 1, 1, pInFile);
fwrite(&szBuffe r[0], 1, dwRead, pOutFile);

// prepare for while loop
bFlag = 0;

// deal with note messages after status message
do {
// convert note and write
dwRead = fread(&szBuffer[0], 1, 1, pInFile);
gmToDKFH(&szBuf fer[0]);
fwrite(&szBuffe r[0], 1, dwRead, pOutFile);

// convert velocity
dwRead = fread(&szBuffer[0], 1, 1, pInFile);

// if velocity is >= 80
if (strcmp(&szBuff er[0], &szVelTarget Off[0]) >= 0) {
// if we're not going to change the hihats later, or this isn't a hihat
if ((!b_useHihat) || (strcmp(&szBuff er[0], &szOpenHat[0])) &&
(strcmp(&szBuff er[0], &szClosedHat[0]))) {
// set new velocity
szBuffer[0] = (char) 0x7f;
}
}
// write velocity
fwrite(&szBuffe r[0], 1, dwRead, pOutFile);

// this byte should be a null, so write it
dwRead = fread(&szBuffer[0], 1, 1, pInFile);
fwrite(&szBuffe r[0], 1, dwRead, pOutFile);

// if we're back at a note_on message, exit loop and push the byte
back into the stream
// if we're at a 0xFF message, we're almost at the end of the file,
so write the byte and exit the loop
// otherwise, push the byte back into the stream and go through the
loop again
dwRead = fread(&szBuffer[0], 1, 1, pInFile);

if (szBuffer[0] == szNoteOn[0]) {
bFlag = 1;
ungetc(szBuffer[0], pInFile);
}
else if (szBuffer[0] == szEOFMarker[0]) {
bFlag = 1;
fwrite(&szBuffe r[0], 1, dwRead, pOutFile);
ungetc(szBuffer[0], pInFile);
}
else {
ungetc(szBuffer[0], pInFile);
}
}
while (!bFlag);
}
// if we don't have a note-on, go back through the loop
else {
fwrite(&szBuffe r[0], 1, dwRead, pOutFile);
}
}
// exit when we get to the end of the file
while (dwRead > 0);

fclose(pInFile) ;
fclose(pOutFile );

--------------------

the "gmToDKFH() " function just takes a byte from the buffer and changes
it according to the midi standard I'm converting to.

Here are some of the relevent strings/chars I'm comparing in the program:

// bytes read
size_t dwRead;

Oh, forget the remarks I made about strcmp() up above, now that I have
seen this. You seem to be very unfamiliar with how characters and C
style strings work. All the places where you are using strcmp() you
could be doing single character compares. But there are other issues.
// single char file buffer
char szBuffer[2];
szBuffer[1] = 0x00;
You don't need this at all, especially if you use fgetc() and fputc()
in place of fread() and fwrite().
// constants
char szNoteOn[2];
sprintf(&szNote On[0], "%c", 0x99);
szNoteOn[1] = 0x00;
Are you aware that you could have written this:

char szNoteOn[2] = { 0x99 };

....and not needed the sprintf() function call at all? Or that if you
do use sprintf(), it will add the '\0' terminator automatically?

I am assuming that you are programming for Windows, and in that case
0x99 is not a valid value for a plain (signed) char. You should be
using unsigned char for all the values read and written from the
binary files, and for the values you compare them to.
char szNoteOnMin[2];
sprintf(&szNote OnMin[0], "%c", MIDI_CMD_NOTE_O N);
szNoteOnMin[1] = 0x00;

char szNoteOnMax[2];
sprintf(&szNote OnMax[0], "%c", 0x9F);
szNoteOnMax[1] = 0x00;

char szNoteOffMin[2];
sprintf(&szNote OffMin[0], "%c", MIDI_CMD_NOTE_O FF);
szNoteOffMin[1] = 0x00;

char szNoteOffMax[2];
sprintf(&szNote OffMax[0], "%c", 0x8F);
szNoteOffMax[1] = 0x00;

char szAllNotesOff[2];
sprintf(&szAllN otesOff[0], "%c", MIDI_CTL_ALL_SO UNDS_OFF);
szAllNotesOff[1] = 0x00;

// velocity 95
char szVelTarget[2];
sprintf(&szVelT arget[0], "%c", 0x5f);
szVelTarget[1] = 0x00;

char szVelTargetOff[2];
sprintf(&szVelT argetOff[0], "%c", 0x50);
szVelTargetOff[1] = 0x00;

// hihat constants
char szOpenHat[2];
sprintf(&szOpen Hat[0], "%c", 0x43);
szOpenHat[1] = 0x00;

char szClosedHat[2];
sprintf(&szClos edHat[0], "%c", 0x3e);
szClosedHat[1] = 0x00;

// 0xFF eof marker for midi
char szEOFMarker[2];
sprintf(&szEOFM arker[0], "%c", 0xff);
szEOFMarker[1] = 0x00;

// null target
char szNull[2];
sprintf(&szNull[0], "%c", 0x00);
szNull[1] = 0x00;

-------------------

If any explanation or further code is needed, I'd be happy to provide.

Thanks


I don't want to sound patronizing, but it seems like you have taken on
a project way beyond your experience level. You need a better grasp
of C style strings, stdio binary file handling, and how array names
are converted to pointers to their first element in most expressions.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.l earn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Oct 3 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2201
by: Adam Hearn | last post by:
Sorry if this difficult to understand but I'm pulling my hair out and could do with some good ideas please... I've developed an application which in .NET as a Windows service which is simply crashing but with no signs/details on where the crash is occuring. Please not that the crash is happening on the server and only when the server is running on a Win2K3 host. App is developed as an N-Tier app (client-processing-processing-data) with...
20
5513
by: Mark | last post by:
I am using gnu g++ version 3.3.2, trying a simple test to read in and then write out a large (100,000 line) text file ########################################## CSTDIO VERSION TO READ/WRITE TEXT FILE: #include <cstdlib> #include <cstdio> using namespace std;
3
3240
by: Shawn August | last post by:
Hello: I am converting a working VB6 program to C#. During testing of the C# version, I noticed the ReadFile API is crashing. The parameters going into the this function are identical to the working VB6 version. I have tried changing the returned buffer datatype from string to object. The program does not crash (no work) if I remove the ref argument on the 2nd argument within the ReadFile API ('psBuffer'). A quick API sniffer revealed:...
0
2654
by: JW | last post by:
I'm using MSVC7.0 and I'm getting a ton of errors with most of them occurring in cstdio. Any thoughts as to what might cause this? d:\Program Files\Microsoft Visual Studio .NET\Vc7 \PlatformSDK\Include\Guiddef.h(161) : error C2065: 'memcmp' : undeclared identifier d:\Program Files\Microsoft Visual Studio .NET\Vc7
6
1946
by: 314ccc | last post by:
I have stumbled upon a very nasty compiler bug. I have boiled it down to the following code. Granted, this code looks nonsensical, trust that the original source did much more and solves a specific problem nicely. The real question here, is why does the compiler compile this without any problems, yet generates code that crashes. This code should do nothing...absolutely nothing. There are some comments in this code that identify places...
5
3302
by: news.cyberlink.ch | last post by:
Hi, We have a DB2 version 7 fixpack 14 installed on Windows 200 at a customer site that is crashing at regular intervals.Everything was working fine for over many years, now since about one month, these crashes have been cropping up. What is really strange is, the crashes occur on two DB2 different servers at the customer site, both running DB2 version 7 fixpack 14, although ater uninstalling OO-Defrag from both servers, one of the...
2
14563
by: david wolf | last post by:
My understanding is that cstdio basically is the same as stdio.h except the functions are in a namspace called std. However when I take a look at the content of the file cstdio, it has the following lines inside only: -------content of cstdio on red hat linux enterprise 3---- #ifndef __CSTDIO__ #define __CSTDIO__ #include <stdio.h> #endif
10
2168
by: Janto Dreijer | last post by:
I have been having problems with the Python 2.4 and 2.5 interpreters on both Linux and Windows crashing on me. Unfortunately it's rather complex code and difficult to pin down the source. So I've been trying to reduce the code. In the process it's started to crash in different ways. I'm not sure if any of it is related. The following is only crashing Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) on win32 in two different(?) ways.
3
2192
by: streamkid | last post by:
hello.. my code is this: //test.cpp #include <cstdio> int main(void) { int NP; char *tmp; FILE *fin;
0
8231
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
8330
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7153
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6107
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5561
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4167
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2603
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1474
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.