LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
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

Tags used in this thread
Popular LQ Tags

Reply
 
Thread Tools
Old 04-24-2006, 02:05 PM   #16
paulsm4
Senior Member
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 3,318
Thanked: 144

[Log in to get rid of this advertisement]
change "char c" to "int c", and life should be beautiful...
paulsm4 is offline     Reply With Quote
Old 04-24-2006, 03:04 PM   #17
spank
Member
 
Registered: Aug 2003
Location: Romania
Distribution: Ubuntu 6.06
Posts: 278
Thanked: 0

Original Poster
why does this work... i mean it starts reading but it doesn't end. Will it find the EOF character ?

on some examples it doesn't work... it segm faults!

Last edited by spank; 04-24-2006 at 03:33 PM..
spank is offline     Reply With Quote
Old 04-24-2006, 06:37 PM   #18
dmail
Member
 
Registered: Oct 2005
Posts: 964
Thanked: 4
I see this is for a huffman tree(of which there are different compressions); when I created a huffman encoder/decoder (in c++) I found it almost essential to create a bit stream class (although you could use structs for the same purpose). Just thought I would throw this idea out there, as it makes reading and writing huffman codes far easier
dmail is offline     Reply With Quote
Old 04-25-2006, 05:30 AM   #19
spank
Member
 
Registered: Aug 2003
Location: Romania
Distribution: Ubuntu 6.06
Posts: 278
Thanked: 0

Original Poster
dmail i must use C not C++. Can you detaliate your ideea ?
spank is offline     Reply With Quote
Old 04-25-2006, 07:50 AM   #20
dmail
Member
 
Registered: Oct 2005
Posts: 964
Thanked: 4
Maybe it would be better if you could see the code first, have a look at
http://linux_questions.pastebin.com/680740 and
http://linux_questions.pastebin.com/680741

This code could then be changed to be standard C using a struct instead of a class (as OO is sortof possible with C, it's just that it's more difficult as it's not an OO language, but structs are not that far from classes).
dmail is offline     Reply With Quote
Old 04-25-2006, 11:45 AM   #21
sundialsvcs
Senior Member
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 2,718
Thanked: 43
Quote:
Originally Posted by spank
dmail i must use C not C++. Can you detaliate your ideea ?
Any "C++ idea" can be reasonably implemented in C using an agreed-upon data structure that is passed to each routine. The routines outside of the implementing unit can treat it as a "void pointer."
sundialsvcs is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

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
representation of binary tree using array sajith Programming 3 10-06-2005 11:59 PM
the bible = the tree of the knowledge of good and evil () Jesus = the tree of life Michael111 General 2 04-14-2004 05:28 PM
Binary search tree insertion in java ksgill Programming 6 02-12-2004 06:11 PM
Printing a binary tree in c? JMC Programming 5 09-26-2003 12:02 PM
need a P-Tree (Patricia Tree) library manaskb Programming 1 11-02-2002 07:15 PM


All times are GMT -5. The time now is 01:55 PM.

Main Menu
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
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration