FILE *msgFile = fopen("MessageFile.log", "w");
.....
fprintf(msgFile, "OK, All Done.\n");
^
^
Thats at the end of my program, and yet it still seg faults.
any Ideas? 16 3656
On Feb 26, 9:48 pm, "Feanor" <Collin.Moer...@gmail.comwrote:
FILE *msgFile = fopen("MessageFile.log", "w");
....
fprintf(msgFile, "OK, All Done.\n");
^
^
Thats at the end of my program, and yet it still seg faults.
any Ideas?
Did you check the return value of fopen()? Try posting a small,
complete, compilable program that exhibits the problematic behavior.
Robert Gamble
In article <11*********************@v33g2000cwv.googlegroups. com>,
Feanor <Co************@gmail.comwrote:
>FILE *msgFile = fopen("MessageFile.log", "w");
>fprintf(msgFile, "OK, All Done.\n");
>Thats at the end of my program, and yet it still seg faults.
>any Ideas?
Did you check to see if fopen() returned NULL ?
--
If you lie to the compiler, it will get its revenge. -- Henry Spencer
Feanor wrote:
FILE *msgFile = fopen("MessageFile.log", "w");
....
fprintf(msgFile, "OK, All Done.\n");
^
^
Thats at the end of my program, and yet it still seg faults.
any Ideas?
Given your apparent reluctance to provide more details and, if
possible, a complete, compilable program that exhibits your problem,
there's not much we can do other than make wild guesses. As others
have said, check whether fopen really does suceed, before using the
associated pointer.
Feanor wrote:
>
FILE *msgFile = fopen("MessageFile.log", "w");
....
fprintf(msgFile, "OK, All Done.\n");
^
Thats at the end of my program, and yet it still seg faults.
any Ideas?
I fail to see any code checking the success of fopen. I also fail
to see where msgFile is fclosed. My crystal ball says one of these
is the cause, since you neglected to post a complete compilable
program, and thus deliberately made it impossible for anyone to
give a correct reply.
--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>
In article <45**************@yahoo.com>,
CBFalconer <cb********@maineline.netwrote:
>FILE *msgFile = fopen("MessageFile.log", "w"); .... fprintf(msgFile, "OK, All Done.\n"); ^ Thats at the end of my program, and yet it still seg faults. any Ideas?
>I fail to see any code checking the success of fopen. I also fail to see where msgFile is fclosed.
How could failure to close msgFile be relevant to a segmentation
fault?
-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Feanor wrote:
>
FILE *msgFile = fopen("MessageFile.log", "w");
....
fprintf(msgFile, "OK, All Done.\n");
^
^
Thats at the end of my program, and yet it still seg faults.
any Ideas?
The error is on line 42.
--
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody | www.hvcomputer.com | #include |
| kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h|
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:Th*************@gmail.com>
On Feb 27, 3:29 pm, Kenneth Brody <kenbr...@spamcop.netwrote:
Feanor wrote:
FILE *msgFile = fopen("MessageFile.log", "w");
....
fprintf(msgFile, "OK, All Done.\n");
^
^
Thats at the end of my program, and yet it still seg faults.
any Ideas?
The error is on line 42.
I disagree! :) I'm almost sure it's a problem with the compiler. heh
>
--
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody |www.hvcomputer.com| #include |
| kenbrody/at\spamcop.net |www.fptech.com | <std_disclaimer.h|
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:ThisIsASpamT...@gmail.com>
Richard Tobin <ri*****@cogsci.ed.ac.ukwrote:
>How could failure to close msgFile be relevant to a segmentation fault?
I think *success* in closing msgFile is what he was worried about, e.g.:
fclose(msgFile);
fprintf(msgFile, "OK, All Done.\n");
-Beej
Richard Tobin wrote:
CBFalconer <cb********@maineline.netwrote:
>>FILE *msgFile = fopen("MessageFile.log", "w"); .... fprintf(msgFile, "OK, All Done.\n"); ^ Thats at the end of my program, and yet it still seg faults. any Ideas?
>I fail to see any code checking the success of fopen. I also fail to see where msgFile is fclosed.
How could failure to close msgFile be relevant to a segmentation
fault?
Please don't snip attributions for material you quote.
I didn't say there was a failure to close. However, writing to a
closed file is likely to provoke undefined behaviour. Likewise
writing to a file whose open failed. The (now unknown, due to
silly attribution snipping) OP failed to post a complete compilable
program and should be suitably chastized.
n--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>
In article <45**************@yahoo.com>,
CBFalconer <cb********@maineline.netwrote:
>I didn't say there was a failure to close. However, writing to a closed file is likely to provoke undefined behaviour.
So you're suggesting that he closed it in the omitted code?
-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Richard Tobin wrote:
CBFalconer <cb********@maineline.netwrote:
>I didn't say there was a failure to close. However, writing to a closed file is likely to provoke undefined behaviour.
So you're suggesting that he closed it in the omitted code?
Check line 42.
--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>
Richard Tobin wrote, On 28/02/07 12:31:
In article <45**************@yahoo.com>,
CBFalconer <cb********@maineline.netwrote:
>I didn't say there was a failure to close. However, writing to a closed file is likely to provoke undefined behaviour.
So you're suggesting that he closed it in the omitted code?
Your crystal ball must be broken, mine says the file was closed on line
42 of the omitted code.
--
Flash Gordon
Flash Gordon wrote:
Richard Tobin wrote, On 28/02/07 12:31:
>CBFalconer <cb********@maineline.netwrote:
>>I didn't say there was a failure to close. However, writing to a closed file is likely to provoke undefined behaviour.
So you're suggesting that he closed it in the omitted code?
Your crystal ball must be broken, mine says the file was closed on
line 42 of the omitted code.
Where did you get your ball? It seems accurate, since it agrees
with mine. I inherited mine from my great grandmother, who died at
90 something in 1940, and I have no earlier provenance. The
problem was lack of an instruction manual, so I have only recently
put it to work. TIP: when it starts to clear you are on the right
track.
--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>
CBFalconer wrote, On 28/02/07 22:18:
Flash Gordon wrote:
>Richard Tobin wrote, On 28/02/07 12:31:
>>CBFalconer <cb********@maineline.netwrote:
I didn't say there was a failure to close. However, writing to a closed file is likely to provoke undefined behaviour. So you're suggesting that he closed it in the omitted code?
Your crystal ball must be broken, mine says the file was closed on line 42 of the omitted code.
Where did you get your ball? It seems accurate, since it agrees
with mine. I inherited mine from my great grandmother, who died at
90 something in 1940, and I have no earlier provenance. The
problem was lack of an instruction manual, so I have only recently
put it to work. TIP: when it starts to clear you are on the right
track.
Mine is a Jewish crystal ball that has been passed down from mother to
eldest daughter since time immemorial, unfortunately my paternal
grandmother (which is the side of the family it came from) did not have
any daughters and nor has my father, so it was passed down to me, the
youngest grandson, instead.
Traditionally crystal balls do not come with separate instruction
manuals, but this is not a problem since one of the thing a crystal ball
can be used to see is instructions on how to use the crystal ball.
--
Flash Gordon
Anyone bought a CD ROM drive and found the instructions and drivers are
provided on a CD?
Flash Gordon wrote:
[...]
Traditionally crystal balls do not come with separate instruction
manuals, but this is not a problem since one of the thing a crystal ball
can be used to see is instructions on how to use the crystal ball.
Unfortunately, there are no instructions on how to get the instruction
manual to appear. (Those instructions are on page 42 of the manual.)
--
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody | www.hvcomputer.com | #include |
| kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h|
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:Th*************@gmail.com>
Kenneth Brody wrote, On 01/03/07 18:38:
Flash Gordon wrote:
[...]
>Traditionally crystal balls do not come with separate instruction manuals, but this is not a problem since one of the thing a crystal ball can be used to see is instructions on how to use the crystal ball.
Unfortunately, there are no instructions on how to get the instruction
manual to appear. (Those instructions are on page 42 of the manual.)
True. This is a deliberate policy to stop the uninitiated from using
crystal balls.
--
Flash Gordon This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: songfire |
last post by:
Hi everyone,
This isn't so much a c++ problem as it is a linux problem, but I am
hoping someone can point me in the right direction.
I have a program that requires a moderately large matrix. I...
|
by: Adi |
last post by:
hi guys,
i have a weird problem with printf statement. I have a function which
just prints a string literal. In my program this function will be
called > 2000 times. I get a segmentation fault...
|
by: Zheng Da |
last post by:
Program received signal SIGSEGV, Segmentation fault.
0x40093343 in _int_malloc () from /lib/tls/libc.so.6
(gdb) bt
#0 0x40093343 in _int_malloc () from /lib/tls/libc.so.6
#1 0x40094c54 in malloc...
|
by: Fra-it |
last post by:
Hi everybody,
I'm trying to make the following code running properly, but I can't get
rid of the "SEGMENTATION FAULT" error message when executing.
Reading some messages posted earlier, I...
|
by: Paminu |
last post by:
I have a wierd problem.
In my main function I print "test" as the first thing. But if I run the call
to node_alloc AFTER the printf call I get a segmentation fault and test is
not printed!
...
|
by: pycraze |
last post by:
I would like to ask a question. How do one handle the exception due to
Segmentation fault due to Python ? Our bit operations and arithmetic
manipulations are written in C and to some of our...
|
by: madunix |
last post by:
My Server is suffering bad lag (High Utlization)
I am running on that server Oracle10g with apache_1.3.35/ php-4.4.2
Web visitors retrieve data from the web by php calls through oci
cobnnection...
|
by: Bryan |
last post by:
Hello all. I'm fairly new to c++. I've written several programs
using std::vectors, and they've always worked just fine. Until today.
The following is a snippet of my code (sorry, can't...
|
by: spiralfire |
last post by:
I wrote a translator, that reads a DIMACS graph format and writes to a simpler format...
basically DIMACS format is:
c comment
p type nodes edges //type is alwats edge on my problems,...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |