Results 1 to 4 of 4
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 ...
- 03-26-2007 #1Just Joined!
- Join Date
- Jun 2006
- Posts
- 24
outputting a 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
- 03-26-2007 #2
I'm unable to understand your problem ..
This is what i understood ,"You have some raw data and you can't able read it because don't know it's structure format" --is this your problem?
please explain bit..may be someone will help.- Lakshmipathi.G
-------------------
FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
-------------------
- 03-26-2007 #3Just Joined!
- Join Date
- Jun 2006
- Posts
- 24
I have a complex structure that doesn't seem to be able to be output using standard printf methods. Just wondered if there was another way to dump it to
screen
- 03-26-2007 #4
Unlike Java, Python, or Ruby, there's no "to string" function that goes along with each structure in C. If you want to output a structure, you pretty much have to know what it's made of. There are two solutions I can think of:
* Compile your problem with debugging info (-g), run it through the debugger, and print the structure from there. gdb knows how to print a structure.
* Find the declaration of the structure (if you can use it, it must be in a file you included) and go from that.Flies of a particular kind, i.e. time-flies, are fond of an arrow.
Registered Linux User #408794


Reply With Quote