LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-11-2004, 03:34 PM   #1
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
program logic comparison and debugging help needed


i have written the following program(s) at:
http://ranmasotome.50megs.com/cppProjects/


both programs use the file in.dat for output

both programs are essentailly the same

the goal is to populate an array with the contents of the input file and output the lines in reverse order to the output file

prep.cpp does not work
prepone.cpp does work

the program prep.cpp genereates out.dat

the program prepone.cpp generates outone.dat

what's more, when compiling and running prep.cpp, the -1100 in out.dat is always the same, but the -858993460 varies from computer to computer

any explanations as to why one works and the other doesn't would be appreciated
 
Old 03-11-2004, 04:05 PM   #2
haobaba1
Member
 
Registered: Jul 2003
Location: VA Tech
Distribution: Mandrake 9.1
Posts: 73

Rep: Reputation: 15
Re: program logic comparison and debugging help needed

Quote:
Originally posted by frieza
i have written the following program(s) at:
http://ranmasotome.50megs.com/cppProjects/


both programs use the file in.dat for output

both programs are essentailly the same

the goal is to populate an array with the contents of the input file and output the lines in reverse order to the output file

prep.cpp does not work
prepone.cpp does work

the program prep.cpp genereates out.dat

the program prepone.cpp generates outone.dat

what's more, when compiling and running prep.cpp, the -1100 in out.dat is always the same, but the -858993460 varies from computer to computer

any explanations as to why one works and the other doesn't would be appreciated
is -858993460 outside the range of int?
 
Old 03-12-2004, 05:09 AM   #3
dmazzoni
LQ Newbie
 
Registered: Mar 2004
Posts: 4

Rep: Reputation: 0
Link broken

It'd be easier to help if your link still worked.

If you're using Linux, download and install valgrind, a memory debugger. I'd be willing to bet it will pinpoint the exact line of your error.
 
Old 03-12-2004, 05:57 AM   #4
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
try the gnu data debugger

ddd, it's fab.

http://www.gnu.org/software/ddd/ddd.html

billy
 
Old 03-12-2004, 11:14 PM   #5
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233

Original Poster
Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
the linke works as far as i can tell
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Debugging C++ so called from java program exitsfunnel Programming 3 10-12-2005 03:01 PM
Visual Debugging and Linux Kernel Debugging Igor007 Programming 0 09-30-2005 10:33 AM
gdb crashes when debugging pthread-ed program tbruer1138 Programming 0 04-21-2005 05:38 PM
Debugging Multithreaded Program villie Programming 2 08-17-2004 11:24 AM
windows to linux program comparison list ampex189 Linux - Newbie 3 08-19-2003 02:05 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration