The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com



High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
script to Read Error,jbase,voilation,segmentation words from a file Mujtaba khan Shell Programming and Scripting 3 03-30-2008 01:19 PM
tar:read error: unexpected EOF mikeruth UNIX for Advanced & Expert Users 4 01-18-2008 05:30 PM
How to prevent an application from closing a file jasahl AIX 4 01-06-2008 09:39 PM
Error : no closing quote in unix pinky UNIX for Dummies Questions & Answers 4 07-30-2007 02:38 PM
Hard error on read, OS error = 32 Franzlebord SUN Solaris 0 05-18-2007 03:05 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-18-2006
ALTRUNVRSOFLN ALTRUNVRSOFLN is offline
Registered User
  
 

Join Date: Mar 2005
Posts: 11
Error closing read file

Every time I close a file that I opened for reading I get the following error: ”Memory fault(coredump)”. And, although it does not (I think) affect the overall process (I write another file based on the file I am reading); it is something I would rather not happen. I don’t know why this is happening but it is also not the only time. I am compiling with the following param: +DD64 -I ~/dev
I would be grateful for any help
  #2 (permalink)  
Old 09-18-2006
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,717
This happens most often because:

the FILE *ptr has changed and no longer points to the FILE structure or points to an invalid struct. buffer overflow -- overwriting the stack -- is acommon way this ocurs.
Code:
FILE *myfile=NULL;
char whatever[4]={0x0};
char *toobig="12341234";
myfile=fopen("something","r");
strcpy(whatever,toobig);
flcose(myfile);
This is a programming error (runtime error). Normally it has very little to do with how you compile a program.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:49 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0