Okay - Now I am beginning to get a bit frustrated. I have a project that
builds perfectly and I just want to duplicate it so I create a new project
with the new name that I want to call it. When It shows me the empty space
to start editing my file I select everything there and delete it. I then
paste into this .cpp file the precise same file from the original .cpp file
that I am trying to start with. I build the file. It compiles without error.
Now I go to debug the file. Where it runs perfectly before it now produces
an error that looks like this:

===================================================================
Microsoft Visual C++ Debug Library [x]
===================================================================
(X) Debug Assertion Failed!

Program:...
File:fseek.c
Line: 100

Expression:(stream !=NULL)

For information on how your program can cause an assertion
failure, see the visual C++ documentation on asserts.

(press Retry to debug the application)

===================================================================
[ Abort ] [ Retry ] [ Ignore ]
===================================================================

(By the way, I don't have any line 100 in my .cpp file. The compiler
must be bringing in fseek.c as i do use fseek in my code.)

I have run a CRC and Checksum on the two versions and there is no
difference between the two .cpp files - they are identical.

What in the dickens could be wrong here since the files where made
in an identical way with identical code?

I an STUMPPED. I am trying to hold back tears! PLEASE HELP!!!

73
-Grace
NNNN
z

Recommended Answers

All 6 Replies

The smiley face was supposed to be '(s' ...

Now i'm smiling :)

Please see the link to the youtube video in my signature.

If you can stand my voice and horrible narrating it will show you one of the best ways to figure out a problem like that, assuming you're using Visual Studio.

Also if you're copying a project you may want to make a blank project, then copy and paste the files you want to work with into the new empty project's directory (Documents/VS2008/projects usually), then in the IDE, right click on the project name and select "add existing item" to add them to the new "solution"/project.

You have not opened the stream successfully - the FILE* pointer was NULL at the time you did an fseek().

Verify that fopen() returned a non-NULL pointer. (Perhaps you are using a relative path to file which is no longer correct for the project copied into a different directory).

Thanks You all again for your help. The problem occured because the file referanced by the code existed in the old project directory but not in the new one. Here is what I learned: 1) When debugging widen your awareness to the whole environment in which the code is running (it is easy to get to focused). 2) In file opperations always make sure that you have access to the file - from a programming standpoint always handle errors when accessing files. 3) stop working on something when you are tired and get some rest. You might have a fresh perspective in the morning! Thanks again!

73
-Grace
NNNN
z

"Another effective technique is to explain your code to someone else. This will often cause you to explain the bug to yourself. Sometimes it takes no more than a few sentences, followed by an embarrassed ``Never mind, I see what's wrong. Sorry to bother you.'' This works remarkably well; you can even use non-programmers as listeners. One university computer center kept a teddy bear near the help desk. Students with mysterious bugs were required to explain them to the bear before they could speak to a human counselor."
- Brian W. Kernighan and Rob Pike in 'The Practice of Programming'

"Another effective technique is to explain your code to someone else. This will often cause you to explain the bug to yourself. Sometimes it takes no more than a few sentences, followed by an embarrassed ``Never mind, I see what's wrong. Sorry to bother you.'' This works remarkably well; you can even use non-programmers as listeners. One university computer center kept a teddy bear near the help desk. Students with mysterious bugs were required to explain them to the bear before they could speak to a human counselor."
- Brian W. Kernighan and Rob Pike in 'The Practice of Programming'

OOps hit submit reply before I replied. Anyway, I do have a teddy bear that I have
been ignoring for some time. I suppose I should dust him off and set him by by
my 'puter. He Is dressed with a scarf for winter anyway. Thanks!

Have a great new year!

73
-Grace
NNNN
z

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.