0

bobsced0$ gcc -g -o prog ss.c
bobsced0$ ./prog
File size is:906984
Segmentation fault
bobsced0$ gdb prog
GNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu"...
(gdb) run
Starting program: /nfs/cluster/home/ncsi23/prog
File size is:906984

Program received signal SIGSEGV, Segmentation fault.
0x0000000000401449 in main (argc=1, argv=0x7fbfffedb8) at ss.c:45
45 while ((position=fgets(buffer,s, infile)) != NULL)
(gdb) print *position
$1 = 0 '\0'
(gdb) print position
$2 = 0x7fbfffed10 ""
(gdb)
Any one help me please. I'm trying to read a large file, i'm getting this error. i can read up to 2 lakh words from a file. but i can't read with more size. Could you help me how to use valgrind in PuTTy .

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by dkalita
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.