This is the output from the debugger. I dont have GDB so used dbx
Code:
dbx a.out
Type 'help' for help.
reading symbolic information ...
(dbx) stop in main
[1] stop in main
(dbx) run
[1] stopped in main at line 8
8 pFile = fopen ( "test.xml" , "rb" );
(dbx) n
stopped in main at line 9
9 if (pFile==NULL) {fputs ("File error",stderr); exit (1);}
(dbx) n
stopped in main at line 11
11 fseek (pFile , 0 , SEEK_END);
(dbx) n
stopped in main at line 12
12 lSize = ftell (pFile);
(dbx) n
stopped in main at line 13
13 rewind (pFile);
(dbx) n
stopped in main at line 15
15 buffer = (char*) malloc (sizeof(char)*lSize);
(dbx) n
stopped in main at line 16
16 if (buffer == NULL) {fputs ("Memory error",stderr); exit (2);}
(dbx) n
stopped in main at line 18
18 printf ("\n size of buffer %ld, length of file %d\n ", sizeof(buffer), lSize);
(dbx) print buffer
(invalid char ptr (0x0000000010000ab0))
(dbx) print buffer
(invalid char ptr (0x0000000010000ab0))
(dbx) print &(*buffer)
0x0000000010000ab0
(dbx) print &buffer
0x0ffffffffffff320
(dbx) n
size of buffer 8, length of file 216
stopped in main at line 20
20 strcpy (buffer, "test message");
(dbx) n
Segmentation fault in strcpy.strcpy [a.out] at 0x10000077c
0x10000077c (strcpy+0x5c) f8e50009 stdu r7,0x8(r5)
(dbx)
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)
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)
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)
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)
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)
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)
Getting memory fault (coredump) and segmentation fault(coredump)
when i tried javac or java -version. what could be the problem?
Regards
Eswar (2 Replies)
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)
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)
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
LEARN ABOUT POSIX
ftello
FTELL(P) POSIX Programmer's Manual FTELL(P)
NAME
ftell, ftello - return a file offset in a stream
SYNOPSIS
#include <stdio.h>
long ftell(FILE *stream);
off_t ftello(FILE *stream);
DESCRIPTION
The ftell() function shall obtain the current value of the file-position indicator for the stream pointed to by stream.
The ftello() function shall be equivalent to ftell(), except that the return value is of type off_t.
RETURN VALUE
Upon successful completion, ftell() and ftello() shall return the current value of the file-position indicator for the stream measured
in bytes from the beginning of the file.
Otherwise, ftell() and ftello() shall return -1, cast to long and off_t respectively, and set errno to indicate the error.
ERRORS
The ftell() and ftello() functions shall fail if:
EBADF The file descriptor underlying stream is not an open file descriptor.
EOVERFLOW
For ftell(), the current file offset cannot be represented correctly in an object of type long.
EOVERFLOW
For ftello(), the current file offset cannot be represented correctly in an object of type off_t.
ESPIPE The file descriptor underlying stream is associated with a pipe or FIFO.
The ftell() function may fail if:
ESPIPE The file descriptor underlying stream is associated with a socket.
The following sections are informative.
EXAMPLES
None.
APPLICATION USAGE
None.
RATIONALE
None.
FUTURE DIRECTIONS
None.
SEE ALSO
fgetpos() , fopen() , fseek() , lseek() , the Base Definitions volume of IEEE Std 1003.1-2001, <stdio.h>
COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technol-
ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE
and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained
online at http://www.opengroup.org/unix/online.html .
IEEE /The Open Group 2003 FTELL(P)