LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 04-24-2006, 01:05 PM   #16
paulsm4
Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled

change "char c" to "int c", and life should be beautiful...
 
Old 04-24-2006, 02:04 PM   #17
spank
Member
 
Registered: Aug 2003
Location: Romania
Distribution: Ubuntu 6.06
Posts: 278

Original Poster
Rep: Reputation: 30
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 02:33 PM.
 
Old 04-24-2006, 05:37 PM   #18
dmail
Member
 
Registered: Oct 2005
Posts: 970

Rep: Reputation: Disabled
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
 
Old 04-25-2006, 04:30 AM   #19
spank
Member
 
Registered: Aug 2003
Location: Romania
Distribution: Ubuntu 6.06
Posts: 278

Original Poster
Rep: Reputation: 30
dmail i must use C not C++. Can you detaliate your ideea ?
 
Old 04-25-2006, 06:50 AM   #20
dmail
Member
 
Registered: Oct 2005
Posts: 970

Rep: Reputation: Disabled
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).
 
Old 04-25-2006, 10:45 AM   #21
sundialsvcs
Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,377

Rep: Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108
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."
 
  


Reply

Tags
programing


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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


All times are GMT -5. The time now is 07:14 AM.

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
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration