Sponsored Content
Top Forums Programming fread: segementation fault(coredump) w/o stdlib.h Post 302286635 by quintet on Wednesday 11th of February 2009 03:19:42 PM
Old 02-11-2009
Quote:
Originally Posted by shamrock
That's because malloc is declared in /usr/include/stdlib.h file and when you remove it from the code malloc is no longer defined and the program core dumps. Did your compiler not warn you of that.
Nope. I did not receive any warnings from the compiler. Moreover when i debug the program it did go through the malloc part without any issue but failed in the fread command.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Coredump (memory fault)

We are running a SQR program on Unix Platform with Oracle RDBMS. It's an interfacing program to integrate data from foreign sites to PeopleSoft database, using a flat file input. After many hours of processing, the program stops with a coredump error (memory fault). With top command we noticed... (1 Reply)
Discussion started by: araziki
1 Replies

2. Programming

Memory fault(coredump)

Dear All, I made a program which do some simple jobs like reading data from other process's shared memory and writing messages to the queues of other process. what happens is my program works fine and do all the task as expected but then then program ends it give Memory fault(coredump). I... (0 Replies)
Discussion started by: ralo
0 Replies

3. Shell Programming and Scripting

Awk:Segementation Fault

I am using awk command to sort a large file (7MB) and compare two files of 7 MB. The code is working fine for smaller files. But it gives following error for larger files Segmentation fault (core dumped) I am doing this on cygwin Please help in this regard Thanks Sandeep (1 Reply)
Discussion started by: sandeep_hi
1 Replies

4. Programming

Passed the compiler,but segementation fault

To find a number if it is a prime number, I cannot find any wrong. #include <stdio.h> #include <stdlib.h> int isPrime(int valToCheck) { int i; int retVal = 1; for(i=1;i<valToCheck;i++) { if(valToCheck%i == 0 && i != 1) { retVal = 0; ... (1 Reply)
Discussion started by: zhshqzyc
1 Replies

5. AIX

Segmentation fault(coredump)

Hi All Can anybody help me? When ever am trying to run topas system gives me an error Segmentation fault(coredump) does anybody ahve solution for this? (4 Replies)
Discussion started by: vjm
4 Replies

6. Ubuntu

Memory fault(coredump)

Hey guys, I am new to the Linux world and have a question to post. When I ssh from a HP-UX machine to a ubuntu machine I get the following error message Memory fault(coredump) i.e. ssh 192.168.1.3 I get this message as shown below Memory fault(coredump) Can someone please explain... (2 Replies)
Discussion started by: fkaba81
2 Replies

7. Solaris

memory fault (coredump)

Getting memory fault (coredump) and segmentation fault(coredump) when i tried javac or java -version. what could be the problem? Regards Eswar (2 Replies)
Discussion started by: BhuvanEswar
2 Replies

8. Shell Programming and Scripting

Segmentation Fault(coredump)

I'm getting this error when trying to run a Acucobol program thru UNIX.. Segmentation Fault(coredump) Precompiler error prevents compilation of xxxxxx.co. Please help me in this case.. (1 Reply)
Discussion started by: Manish4
1 Replies

9. Homework & Coursework Questions

Memory fault(coredump)

I am writing a program that copies a program and prints the program with a line count. this is the program I wrote: #include <stdio.h> main() { int c; int nl_cnt = 0; while((c = getchar()) != EOF){ if(c = '\n'){ nl_cnt++;... (3 Replies)
Discussion started by: heywoodfloyd
3 Replies

10. UNIX for Advanced & Expert Users

Memory fault(Coredump)

Hi, In my application we have one job which is used to process the files. But that job is failing with memory fault while processing a file or while shutting down the job. Sometime it generates the coredump and sometimes not. When I analysed the core dump I got below code snippet where it... (3 Replies)
Discussion started by: shilpa_20
3 Replies
FSEEK(3)						     Linux Programmer's Manual							  FSEEK(3)

NAME
fgetpos, fseek, fsetpos, ftell, rewind - reposition a stream SYNOPSIS
#include <stdio.h> int fseek(FILE *stream, long offset, int whence); long ftell(FILE *stream); void rewind(FILE *stream); int fgetpos(FILE *stream, fpos_t *pos); int fsetpos(FILE *stream, fpos_t *pos); DESCRIPTION
The fseek function sets the file position indicator for the stream pointed to by stream. The new position, measured in bytes, is obtained by adding offset bytes to the position specified by whence. If whence is set to SEEK_SET, SEEK_CUR, or SEEK_END, the offset is relative to the start of the file, the current position indicator, or end-of-file, respectively. A successful call to the fseek function clears the end-of-file indicator for the stream and undoes any effects of the ungetc(3) function on the same stream. The ftell function obtains the current value of the file position indicator for the stream pointed to by stream. The rewind function sets the file position indicator for the stream pointed to by stream to the beginning of the file. It is equivalent to: (void)fseek(stream, 0L, SEEK_SET) except that the error indicator for the stream is also cleared (see clearerr(3)). The fgetpos and fsetpos functions are alternate interfaces equivalent to ftell and fseek (with whence set to SEEK_SET), setting and storing the current value of the file offset into or from the object referenced by pos. On some non-UNIX systems an fpos_t object may be a complex object and these routines may be the only way to portably reposition a text stream. RETURN VALUE
The rewind function returns no value. Upon successful completion, fgetpos, fseek, fsetpos return 0, and ftell returns the current offset. Otherwise, -1 is returned and the global variable errno is set to indicate the error. ERRORS
EBADF The stream specified is not a seekable stream. EINVAL The whence argument to fseek was not SEEK_SET, SEEK_END, or SEEK_CUR. The function fgetpos, fseek, fsetpos, and ftell may also fail and set errno for any of the errors specified for the routines fflush(3), fstat(2), lseek(2), and malloc(3). CONFORMING TO
The fgetpos, fsetpos, fseek, ftell, and rewind functions conform to ANSI X3.159-1989 (``ANSI C''). SEE ALSO
lseek(2), fseeko(3) BSD MANPAGE
1993-11-29 FSEEK(3)
All times are GMT -4. The time now is 06:17 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy