LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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-26-2007, 05:13 AM   #1
Josephus Ross
LQ Newbie
 
Registered: Mar 2007
Posts: 22

Rep: Reputation: 15
dumping structure in C


Hi all,

I have a structure and I don't know what it is made of. Could somebody tell me how to output/dump a structure to the screen in a command prompt environment using C.

Joe
 
Old 03-26-2007, 05:32 AM   #2
slzckboy
Member
 
Registered: May 2005
Location: uk - Reading
Distribution: slackware 14.2 kernel 4.19.43
Posts: 462

Rep: Reputation: 30
use gdb,making sure you compile the program with the gcc -g switch.

Loads of howto's etc on the net for gdb.
 
Old 03-26-2007, 06:24 AM   #3
bartonski
Member
 
Registered: Jul 2006
Location: Louisville, KY
Distribution: Fedora 12, Slackware, Debian, Ubuntu Karmic, FreeBSD 7.1
Posts: 443
Blog Entries: 1

Rep: Reputation: 48
Quote:
Originally Posted by Josephus Ross
Hi all,

I have a structure and I don't know what it is made of. Could somebody tell me how to output/dump a structure to the screen in a command prompt environment using C.

Joe
You could write the structure to a file using fwrite(), then use od view the file.
 
Old 03-26-2007, 08:03 AM   #4
KenJennings
LQ Newbie
 
Registered: Mar 2005
Location: FL, USA
Distribution: SuSE
Posts: 28

Rep: Reputation: 15
If you can write code referencing the structure there likely is an include file somewhere on your system that contains the declaration. (Though, not guaranteed, since the implementor could hide the internals by only defining a pointer for everyone else to use.)
 
Old 03-26-2007, 09:04 PM   #5
bartonski
Member
 
Registered: Jul 2006
Location: Louisville, KY
Distribution: Fedora 12, Slackware, Debian, Ubuntu Karmic, FreeBSD 7.1
Posts: 443
Blog Entries: 1

Rep: Reputation: 48
Quote:
Originally Posted by Josephus Ross
Hi all,

I have a structure and I don't know what it is made of. Could somebody tell me how to output/dump a structure to the screen in a command prompt environment using C.

Joe
You could write the structure to a file using fwrite(), then use od view the file.
 
  


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
dumping a structure into a file Pratik H Pandya Programming 5 03-17-2006 04:08 PM
Novell is dumping KDE, so I'll be dumping SuSE KimVette SUSE / openSUSE 10 11-12-2005 08:09 PM
Dumping a strange CD r0b0 Linux - General 2 01-27-2005 05:51 PM
Core dumping... JanusPaul Programming 2 01-24-2005 10:26 PM
dumping sound gazza Linux - Newbie 0 02-28-2004 12:40 PM

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

All times are GMT -5. The time now is 11:22 AM.

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