Re: [c-prog] Need help for open docx

2010-07-26 Thread andrew clarke
On Sun 2010-07-25 21:11:27 UTC-0700, Esmaeil MIRZAEE (esmaeilmirz...@yahoo.com) 
wrote:

 I need a header for open/read docx file.

Header files don't work that way.  They mostly contain declarations,
not actual code that does anything.

http://en.wikipedia.org/wiki/Header_file

 For example I write my own Office.

Good luck with that.

You'd be better off starting out with working code, eg. Abiword.  But
from your initial question it sounds as though you have a lot to learn
about C/C++ first before you try to do anything so advanced.


Re: [c-prog] Need help for open docx

2010-07-26 Thread Brett McCoy
On Mon, Jul 26, 2010 at 12:11 AM, Esmaeil MIRZAEE
esmaeilmirz...@yahoo.com wrote:
 Hi all

 I need a header for open/read docx file.

 For example I write my own Office.


 Best Regards

 Esmaeil MIRZAEE

 PS:I use Linux and C++

Start with the source code from Open Office:

http://download.openoffice.org/source/index.html

They also have an SDK, which is probably what you'd want to use (just
getting the header won't accomplish what you want).

Good luck

-- Brett

In the rhythm of music a secret is hidden;
    If I were to divulge it, it would overturn the world.
               -- Jelaleddin Rumi


Re: [c-prog] Need help for open docx

2010-07-26 Thread Thomas Hruska
On 7/26/2010 5:07 PM, andrew clarke wrote:
 On Sun 2010-07-25 21:11:27 UTC-0700, Esmaeil MIRZAEE 
 (esmaeilmirz...@yahoo.com) wrote:

 I need a header for open/read docx file.

 Header files don't work that way.  They mostly contain declarations,
 not actual code that does anything.

 http://en.wikipedia.org/wiki/Header_file

 For example I write my own Office.

 Good luck with that.

 You'd be better off starting out with working code, eg. Abiword.  But
 from your initial question it sounds as though you have a lot to learn
 about C/C++ first before you try to do anything so advanced.

If it were _easy_ to create an Office clone, everyone would do that as 
their first software project in school and Microsoft's #2 cash cow 
wouldn't be a cash cow.  Even I know better than to try to take on such 
a project.


A quick Google search turned up:

http://openxmldeveloper.org/articles/OpenXMLsamples.aspx

-- 
Thomas Hruska
CubicleSoft President

Barebones CMS is a high-performance, open source content management 
system for web developers operating in a team environment.

An open source CubicleSoft initiative.
Your choice of a MIT or LGPL license.

http://barebonescms.com/



Re: [c-prog] Need help...

2009-06-30 Thread Thomas Hruska
rasheed abdul wrote:
 Dear friends,
 In one Algorithm for opening HDF file format in C, I seen that 
 they declared varible in data type as int8, int16, int32. May I know what it 
 is.. 
  
 While I declared like that in my prgram it showing error as declaration 
 syntex error... Plz guide me... 

They probably defined it somewhere in their headers using the 'typedef' 
keyword prior to actually using it.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/



Re: [c-prog] Need Help.. CMD

2009-06-30 Thread Thomas Hruska
rasheed abdul wrote:
  Dear friends,
Can you plz guide me to run a C or Cpp program through CMD 
 in Windows Xp. I am not familiar in CMD so Plz guide me in step by step 

http://www.google.com/search?q=command+prompt+tutorial

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/



Re: [c-prog] Need help...

2009-06-30 Thread Jim Smith
Types  bool,  char, wchar_t, and the signed and unsigned integer types


  are collectively called integral types. 

On my system type char is 8 bits, short int is 16 bits, int is 32 bits, long 
long is 64 bits. 

I can define the types you mentioned like this:



p, li { white-space: pre-wrap; }

typedef char int8;
typedef short int  int16;
typedef int int32;


p, li { white-space: pre-wrap; }

 coutcharsizeof(int8)
  , short int  sizeof(int16)
  , int   sizeof(int32)
  , long longsizeof(long long) // typedef long long int64
  endl ;
 -space: pre-wrap; }and use the types
  int16 Int_16 = 0;  int8   Int_8   = 0 ;  int32 Int_32 = 0 ;

Hope this is helpful.

Best Regards,
Jim Smith
--- On Tue, 6/30/09, rasheed abdul rashu_76...@yahoo.com wrote:

From: rasheed abdul rashu_76...@yahoo.com
Subject: [c-prog] Need help...
To: c-prog@yahoogroups.com
Date: Tuesday, June 30, 2009, 6:40 AM
















  
  

Dear friends,

    In one Algorithm for opening HDF file format in C, I seen that they 
declared varible in data type as int8, int16, int32. May I know what it is.. 

 

While I declared like that in my prgram it showing error as declaration syntex 
error... Plz guide me... 



Love Cricket? Check out live scores, photos, video highlights and more. Click 
here http://cricket. yahoo.com



[Non-text portions of this message have been removed]




 

  




 

















  

[Non-text portions of this message have been removed]



Re: [c-prog] need help in this code

2009-04-12 Thread Tyler Littlefield
we don't correct your code and mail it off to some other place...
I recommend you use something other than turbo to get going.


Thanks,
Tyler Littlefield
Web: tysdomain.com
email: ty...@tysdomain.com
My programs don't have bugs, they're called randomly added features.

  - Original Message - 
  From: vipsiboy 
  To: c-prog@yahoogroups.com 
  Sent: Sunday, April 12, 2009 1:44 AM
  Subject: [c-prog] need help in this code






  #includeiostream.h
  #includeconio.h

  #includefstream.h

  #includestdlib.h
  int main(int argc,char *argv[])
  {
  int number[9]={11,22,33,44,55,66,77,88,99};
  if(argc!=3)
  {
  coutargc = argc\n;
  couterror in args\n;

  }

  ofstream fout1,fout2;
  fout1.open(argv[1]);
  if (fout1.fail())
  {
  coutcould t open file;

  }

  fout2.open(argv[2]);
  if (fout2.fail())
  {
  coutcould nt open file;

  }

  for(int i=0;i9;i++)
  {
  if(number[i]%2==0)
  fout2number[i] ;
  else
  fout2number[i] ;
  }

  fout1.close();
  fout2.close();
  getch();
  return 0;

  }

  this code written in turbo c++ compiles  givs success.
  bt showing error while run..
  can anyone help me with this code...
  pls mail the copy of correct code to hans.vi...@gmail.com 



  

[Non-text portions of this message have been removed]



Re: [c-prog] need help in this code

2009-04-12 Thread Thomas Hruska
vipsiboy wrote:
snip
 this code written in turbo c++ compiles  givs success.
 bt showing error while run..
 can anyone help me with this code...
 pls mail the copy of correct code to hans.vi...@gmail.com 

Well, you did put forth effort, but you are using an ancient compiler 
and simply asking for a handout solution when we aren't exactly sure 
what you are attempting to do in the first place.  Just saying, It has 
an error is really generic and ultimately useless.  Modern compilers 
have what are known as debuggers that typically go hand-in-hand with 
each other.  First upgrade your compiler, then learn how to use the 
debugger (set breakpoints, step through the code line-by-line, see the 
values of variables at each break, etc.)


The old Borland Turbo C/C++ and the Visual Studio 6 compiler suites are 
incredibly old compilers that are outdated, non-ANSI C/C++ Standards 
compliant, no one in the industry uses them, and there are infinitely 
better alternatives out there - many are free - you just have to know 
where to look. Most members of c-prog will generally not answer 
questions involving such compilers and will simply tell you to upgrade 
to a much more modern compiler.

Finding a new compiler is quite easy. c-prog maintains a massive 'Links' 
section on its website. One of those sections is entitled Compilers 
(free):

http://tech.groups.yahoo.com/group/c-prog/links/Compilers_000986587674/

There are hundreds of free compilers to choose from. However, there are 
just a handful that are popular, well supported, ANSI Standard, and free:

Microsoft Visual C++ 2008 Express
wxDev-C++
MinGW
gcc/g++

C++ compilers are usually backwards-compatible and will also compile C 
code.  Of the compilers listed, Microsoft Visual C++ (including Express) 
currently has the best debugger on the planet - period.  If you are 
learning C/C++, the ability to step through code line by line and see 
what is wrong is invaluable.  Other compiler suites have debuggers but 
aren't nearly as good.

Should you choose to learn C++ using Microsoft Visual C++, the following 
video tutorial on using the IDE is highly recommended material:

http://msdn.microsoft.com/en-us/beginner/bb964629.aspx


There are two commercial (non-free) compilers worth mentioning as well. 
Compilers that are not free have to provide a LOT of added value to 
justify their cost.

Microsoft Visual Studio 2008 Professional - In general, if you plan on 
doing Microsoft Windows-specific GUI development (e.g. involving COM, 
ATL, MFC, Office, Vista, etc.), this is the development suite to have. 
Many developers enhance the environment with third-party tools such as 
Visual Assist X.  Also, a number of popular open source projects (e.g. 
TortoiseSVN) will completely build only under the latest version of 
Visual Studio Professional.  Be prepared to pay Microsoft prices though.

Comeau C++ - This is the most ANSI Standards compliant compiler in 
existence. Period. And it is available for virtually every modern 
platform. They have an online code compiler so you can see if code that 
doesn't compile under your compiler, but should, will compile under theirs.


-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/



Re: [c-prog] Need help on linklists

2009-02-26 Thread Tyler Littlefield
google.com surely will.

  - Original Message - 
  From: shafaq mussadiq 
  To: c-prog@yahoogroups.com 
  Sent: Thursday, February 26, 2009 10:12 AM
  Subject: [c-prog] Need help on linklists


  hello;
   
  can anyone one provide me code for inserting and deleting any desired element 
from a link list .

  [Non-text portions of this message have been removed]



  

[Non-text portions of this message have been removed]



Re: [c-prog] Need Help......

2009-02-10 Thread pavan kumar kakumani
'Let us C' by Yashwant Kanetkar is the best book

On Mon, Feb 2, 2009 at 10:04 PM, priyanka patel patelpriyank...@yahoo.co.in
 wrote:

   HiFriends
 i just started Balaguruswami C book.but i want to read book which have
 examples from basic levels with explaination so anyone can suggest me some
 good examples book name and if anyone has then kindly send to me.pls frds
 send it fast its very urgent



 Regards,


 Add more friends to your messenger and enjoy! Go to
 http://messenger.yahoo.com/invite/

 [Non-text portions of this message have been removed]

  



[Non-text portions of this message have been removed]



Re: [c-prog] Need Help......

2009-02-10 Thread Thomas Hruska
pavan kumar kakumani wrote:
 'Let us C' by Yashwant Kanetkar is the best book

Second-worst author ever.  Single-handedly caused the Turbo C plague in 
India.  Stop recommending him.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/



Re: [c-prog] Need Help......

2009-02-08 Thread PROSENJIT CHAKRABORTY
Hello,

In response to your mail I would request you, to study Jaswant Kanitkar's 'Let 
Us C' - Book  or to learn 'C' from basic level. After complete the 
above mentioned book you can study Gotfread's 'C' - Book, which is a standard 
book to learn 'C' clearly and than Balaguruswami. 

Thanks
 
Regards,
Prosenjit 





From: priyanka patel patelpriyank...@yahoo.co.in
To: c-prog@yahoogroups.com
Sent: Monday, 2 February, 2009 11:04:32 PM
Subject: [c-prog] Need Help..


HiFriends
i just started Balaguruswami C book.but i want to read book which have examples 
from basic levels with explaination so anyone can suggest me some good examples 
book name and if anyone has then kindly send to me.pls frds send it fast its 
very urgent
 
 
 
Regards,
 

Add more friends to your messenger and enjoy! Go to http://messenger. 
yahoo.com/ invite/

[Non-text portions of this message have been removed]

 


  Download prohibited? No problem. CHAT from any browser, without download. 
Go to http://in.webmessenger.yahoo.com/

[Non-text portions of this message have been removed]



Re: [c-prog] Need Help......

2009-02-08 Thread Thomas Hruska
PROSENJIT CHAKRABORTY wrote:
 Hello,
 
 In response to your mail I would request you, to study Jaswant Kanitkar's 
 'Let Us C' - Book  or to learn 'C' from basic level. After complete the above 
 mentioned book you can study Gotfread's 'C' - Book, which is a standard book 
 to learn 'C' clearly and than Balaguruswami. 
 
 Thanks
  
 Regards,
 Prosenjit 

Yashwant/Yashawant/Jaswant (can we figure out how to spell this guy's 
name, I've seen it written at least a half-dozen different names) is the 
second worst author of C books - recommends/mentions Turbo C.  He 
single-handedly created the Turbo C plague in India and does NOT follow 
the ANSI C Standard.  Avoid at all costs.


For Gottfried (I couldn't find a 'Gotfread'):

http://www.amazon.com/Schaums-Outline-Programming-Byron-Gottfried/dp/0070240353

One of the reviewers states:

Not updated to current ANSI standard!

The preface by the author suggests that the second (current) edtion 
reflects the current ANSI standard.
('The sample programs conforms to the ANSI C standard').

I found examples where it does not:

On page 294, the author states that 'an array within a function MUST be 
defined as a STATIC array so that it can be initialized'.

The are numerous examples which correspond the classic C but not the ANSI C:

Exmaples 10.14, 10.12..

A statement on page 215: 'automatic arrays can not be initialized is 
not also correct'.


Does anyone have a copy of the book that can confirm this?  (Although 
given that his C++ books have examples that do not compile, I'm 
inclined to believe the review.)

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/



Re: [c-prog] Need Help......

2009-02-05 Thread Akter Suriya
Boss,
she is just a beginner,
If in the beginning only you try to give him so much load, she will
definitely run away by only looking at the content table of the book ;)

On Tue, Feb 3, 2009 at 7:53 PM, Thomas Hruska thru...@cubiclesoft.comwrote:

   vivek tadaskar wrote:
  you can try c by yashavant kanetkar or the best can be c complete
 reference

 Good grief! Yashwant/Yashavant Kanetkar is one of the WORST authors in
 existence. Stop recommending him. He recommends/mentions the use of
 Turbo C, an ancient C compiler and does NOT use ANSI Standard code. You
 will also get zero help from this group.

 When you joined c-prog, you should have received an e-mail containing
 the group welcome message. In that message was a list of books that you
 should read. Just in case you missed the message, here is that list of
 books again and the order in which you should be reading them:

 Accelerated C++ by Koenig and Moo (ISBN #020170353X)
 Safe C++ Design Principles by Thomas Hruska
 The C++ Standard Library by Nicolai Josuttis (ISBN #0201379260)
 Effective C++ by Scott Meyers (ISBN #0201924889)
 More Effective C++ by Scott Meyers (ISBN #020163371X)

 If you are learning or looking to learn C, consider learning C++
 instead. It is much more versatile and offers powerful features that C
 doesn't offer. If you happen to be already reading something other than
 the books above, seriously consider supplementing or replacing your book
 with the above.

 If you can't afford the books mentioned, Bruce Eckel offers Thinking in
 C++ for free from his website:

 http://mindview.net/Books/TICPP/ThinkingInCPP2e.html

 And the group owner, Thomas Hruska, has generously donated his book
 Safe C++ Design Principles to c-prog group members for free:

 http://tech.groups.yahoo.com/group/c-prog/files/Books/

 Beware any C/C++ author who does not adhere closely to the ANSI C/C++
 Standard. One very popular author is Yashavant Kanetkar who is the
 author of Let Us C. His writing may be simple to understand however
 his code is non-ANSI Standard. Similar great writers have shown up over
 the years who tell wonderful stories but don't adhere to the Standards
 defined by the ANSI C/C++ committees.

 You should also obtain at least copy of a draft copy of the ANSI C/C++
 Standard. Draft copies are free and c-prog links to quite a few of them
 here:

 http://tech.groups.yahoo.com/group/c-prog/links/Standards_001012496381/

 --
 Thomas Hruska
 CubicleSoft President
 Ph: 517-803-4197

 *NEW* MyTaskFocus 1.1
 Get on task. Stay on task.

 http://www.CubicleSoft.com/MyTaskFocus/

  




-- 
Akter Yakub Suriya
Senior Software Analyst
Hyderabad.
(09440711663)


[Non-text portions of this message have been removed]



Re: [c-prog] Need Help......

2009-02-05 Thread Thomas Hruska
Akter Suriya wrote:
 Boss,
 she is just a beginner,
 If in the beginning only you try to give him so much load, she will
 definitely run away by only looking at the content table of the book ;)

Doesn't change the fact that Yashwant is the second worst C/C++ author 
in existence.  Herbert Schildt having the honor of being the worst.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/



Re: [c-prog] Need Help......

2009-02-03 Thread nomi
Hi Priyanak!

hope you and everybody there will be good and enjoying a good health.We you
can use Let us C Yashwant kanitkar ... and you can also use herbert
schildt's book Introduction to C and most important Programming using Turbo
C

so hope it might help you and one more thing try to find some tutorials of C
on google it might also help you.

So happy coding

Nouman Naseer
Bsc Spring 2005
PUCIT,Lahore
www.pucit.edu.pk
+923214795194

On Mon, Feb 2, 2009 at 10:34 PM, priyanka patel patelpriyank...@yahoo.co.in
 wrote:

   HiFriends
 i just started Balaguruswami C book.but i want to read book which have
 examples from basic levels with explaination so anyone can suggest me some
 good examples book name and if anyone has then kindly send to me.pls frds
 send it fast its very urgent



 Regards,


 Add more friends to your messenger and enjoy! Go to
 http://messenger.yahoo.com/invite/

 [Non-text portions of this message have been removed]

  




--


[Non-text portions of this message have been removed]



Re: [c-prog] Need Help......

2009-02-03 Thread Fred Hoeldtke
Your KR reference is very old and like a lot of old
testiment stuff for use at the DOS level.  Quick C and C++ by microsoft are for 
use with a Windows
based operating system.  You badly need to go to
a local dealers, teachers, or consultants to upgrade
many years of development .
  - Original Message - 
  From: Prince Annan Koomson 
  To: c-prog@yahoogroups.com 
  Sent: Tuesday, February 03, 2009 5:18 AM
  Subject: Re: [c-prog] Need Help..


  Oh okay, for C books reading some books like Let us C and K  R C language 
and practical C for the introduction to the world of C.

  Prince Annan Koomson

  --- On Mon, 2/2/09, priyanka patel patelpriyank...@yahoo.co.in wrote:
  From: priyanka patel patelpriyank...@yahoo.co.in
  Subject: [c-prog] Need Help..
  To: c-prog@yahoogroups.com
  Date: Monday, February 2, 2009, 5:34 PM

  HiFriends

  i just started Balaguruswami C book.but i want to read book which have 
examples from basic levels with explaination so anyone can suggest me some good 
examples book name and if anyone has then kindly send to me.pls frds send it 
fast its very urgent

   

   

   

  Regards,

   

  Add more friends to your messenger and enjoy! Go to http://messenger. 
yahoo..com/ invite/

  [Non-text portions of this message have been removed]











  [Non-text portions of this message have been removed]



   


--



  Internal Virus Database is out of date.
  Checked by AVG - http://www.avg.com 
  Version: 8.0.176 / Virus Database: 270.9.17/1847 - Release Date: 12/13/2008 
4:56 PM


[Non-text portions of this message have been removed]



Re: [c-prog] Need Help......

2009-02-03 Thread andrew clarke
On Tue 2009-02-03 16:48:23 UTC-0500, Fred  Hoeldtke (e...@verizon.net) wrote:

 Quick C and C++ by microsoft are for use with a Windows
 based operating system.

Microsoft Quick C is 20 years old and was for building DOS programs.
There was a version for Windows 3.x but it was not very popular.

http://en.wikipedia.org/wiki/QuickC

Perhaps you meant Microsoft Visual C++.


Re: [c-prog] need help please

2009-01-19 Thread Brett McCoy
On Mon, Jan 19, 2009 at 4:20 PM, comm_eng_amr comm_eng_...@yahoo.com wrote:

 Hi everybody
 i'm starting my first program using C#2005
 the program is simply a database storing my eBooks
 the problems i faced are so easy but as a beginner are hard

 1- i need to create a class to initialize the ADO.NET
   dataset,adapter,... and how to use it in the program
 2- i wanna build another project in the program to serialize the ebooks
   to and from the database ,then how to inialize these projects inside
   the main program

This isn't a C# list, but for C and C++. These languages aren't much
related (C# is closer to Java and VB than C or C++, as far as I can
tell).

This list would be more appropriate:

http://tech.groups.yahoo.com/group/dot_net_community

-- Brett

In the rhythm of music a secret is hidden;
If I were to divulge it, it would overturn the world.
   -- Jelaleddin Rumi


Re: [c-prog] need help please

2009-01-19 Thread Tyler Littlefield
You've told us what you want to do.
What do you want to get out of telling us your goals?
It's great to have them, but we need something concrete if you want help.


Thanks,
Tyler Littlefield
http://tysdomain.com

  - Original Message - 
  From: comm_eng_amr 
  To: c-prog@yahoogroups.com 
  Sent: Monday, January 19, 2009 2:20 PM
  Subject: [c-prog] need help please


  Hi everybody
  i'm starting my first program using C#2005
  the program is simply a database storing my eBooks
  the problems i faced are so easy but as a beginner are hard

  1- i need to create a class to initialize the ADO.NET 
  dataset,adapter,... and how to use it in the program
  2- i wanna build another project in the program to serialize the ebooks 
  to and from the database ,then how to inialize these projects inside 
  the main program

  thanx alot



   

  __ NOD32 3778 (20090119) Information __

  This message was checked by NOD32 antivirus system.
  http://www.eset.com


[Non-text portions of this message have been removed]



Re: [c-prog] need help please

2009-01-19 Thread Thomas Hruska
comm_eng_amr wrote:
 Hi everybody
 i'm starting my first program using C#2005
 the program is simply a database storing my eBooks
 the problems i faced are so easy but as a beginner are hard
 
 1- i need to create a class to initialize the ADO.NET   
dataset,adapter,... and how to use it in the program
 2- i wanna build another project in the program to serialize the ebooks 
to and from the database ,then how to inialize these projects inside 
the main program
 
 thanx alot

#1 - ADO is overrated and ties you to a specific platform (Windows). 
Look at ODBC instead.

#2 - That's an implementation detail that is left up to you.  However, 
storing binary data in a database is, IMO, a bad idea.  You will bloat 
the database with unnecessary data making row sizes quite large, have to 
use blobs, and you won't be able to script against it.

Why do you need to implement this in C#?  Any time you start fiddling 
with databases is, IMO, the time to look at a scripting language as an 
option.  You may end up decided to go the compiled route (for 
performance reasons), but if it is quick-n-dirty, then a scripting 
language is probably a better route - plus you usually get the bonus of 
a web app. out of the deal.  Use the right tool for the job.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/



Re: [c-prog] need help

2008-11-18 Thread David Hamill
 how can we use pointers
 on a two dimensional array please explain 

Can you be more specific?

You can find general information here:
http://www.google.com/search?q=pointer+%22two+dimensional+array%22+c

David



Re: [c-prog] need help

2008-11-18 Thread Bill Cunningham

- Original Message - 
From: David Hamill [EMAIL PROTECTED]
To: c-prog@yahoogroups.com
Sent: Tuesday, November 18, 2008 8:53 AM
Subject: Re: [c-prog] need help


 how can we use pointers
 on a two dimensional array please explain 
 
 Can you be more specific?

What are you trying to do? 

Bill



Re: [c-prog] Need help

2008-11-15 Thread Thomas Hruska
s_zhbjvd wrote:
 And one more point they must be made by using two dimensional arrays.

This appears to be a homework problem.  Most homework style problems are 
supplied by educational institutions to be done by the individual. 
Educational institutions usually provide resources for struggling 
students to help them through homework problems which the student is 
having difficulty with.  If you got this problem from an educational 
institution, please consider using that valuable support resource.  The 
alternative is that someone here could provide you a solution.  However, 
if you pass it off as your own, that is called plagiarism.  The 
punishment for plagiarism is usually a failing grade or expulsion 
depending on the educational institution you attend.  It is NOT 
embarrassing to ask for help nor will it cause any grade deduction when 
using the official methods of help provided by educational institutions.

c-prog demands excellence from its members.  You won't learn anything if 
anyone simply provides you with a solution.  In fact, you will likely 
become dependent upon the group and a burden to other people should you 
get a programming job.  Today's business world demands self-reliance.

If you wish to receive an answer to your question, you need to show us 
what you have done so far.  Show us that you have made an effort - 
source code, Google queries, something, anything.  If you are truly 
stumped, then describe in detail what exactly you don't understand.


-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/



Re: [c-prog] Need Help

2008-11-15 Thread David Hamill

 Can anybody of you can help me
 in making a program of multiplying two matrices of 3X3 
 order.I will be
 very thankful.
 And one more point they must be made by using two 
 dimensional arrays.

This is not a difficult problem if you understand what 
matrix multiplication is. So have a go at it yourself. If 
you run into problems, show us your code and you may get 
helpful comments.

David



Re: [c-prog] Need Help

2008-11-15 Thread satish
It would have taken you lesser work ( and of course hearing lesser
`words` from the group ) , if you had searched for 
matrix multiplication in C  on www.google.com  ,.. 

then if you had any problems understanding how it is implemented in C or
if you had some doubts , well then the group would have been a good
place to start with ,  


ACTUALLY YOU CAN STILL DO WHAT I HAVE MENTIONED ABOVE . WE WILL STILL BE
READY TO HELP IF YOU FACE ANY PROBLEMS WITH THE CODE ... BUT FIRST  
MAKE AN EFFORT  

On Sat, 2008-11-15 at 16:49 +, s_zhbjvd wrote:
 hello how are you all ? I am fine , hey Can anybody of you can help
 me 
 in making a program of multiplying two matrices of 3X3 order.I will
 be 
 very thankful.
 
 
 
 
  
-- 
http://satish.playdrupal.com



Re: [c-prog] need help

2008-08-04 Thread Thomas Hruska
osho ratha wrote:
 
 hello friends i need your guidance .
 how to get print out and what is the command or coding to get a hard copy 
 print out
 can you give me a example coding.
 thanking you.

Printing is an OS-specific task.  You generally have to describe what 
you want to print either through various APIs or use an external 
program.  There is no single magical way to print especially when you 
start considering the differences between a printer and a monitor.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/



Re: [c-prog] need help

2008-08-02 Thread nag
Could you be specific about what you're looking for?
-nag.
On Sat, Aug 2, 2008 at 5:45 PM, osho ratha [EMAIL PROTECTED] wrote:

   hello friends,
 can i get the details of basic mathamatical calculation which is used to
 write codings and building programmes if there is any pdf file sent or give
 me sugession of books.
 thanking you

 Be the first one to try the new Messenger 9 Beta! Go to
 http://in.messenger.yahoo.com/win/

 [Non-text portions of this message have been removed]

 




-- 
Cheers,
-nag.


[Non-text portions of this message have been removed]



Re: [c-prog] need help

2008-08-02 Thread andrew clarke
On Sat 2008-08-02 17:45:26 UTC+0530, osho ratha ([EMAIL PROTECTED]) wrote:

 can i get the details of basic mathamatical calculation which is used
 to write codings and building programmes

algorithms

 if there is any pdf file sent or give me sugession of books.

The Art of Computer Programming by Donald Knuth.


Re: [c-prog] [Need help] Want code for the project Urgent plzzz help me soon

2008-05-06 Thread Benjamin Scott
What is this for?  A computer
worm is the first thing that
comes to my mind.  Ad Hoc
networks are dangerous: Don't
touch them with a 10-foot pole.


  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ


Re: [c-prog] Need Help

2008-04-23 Thread Brett McCoy
On Wed, Apr 23, 2008 at 1:23 PM, ~Rick [EMAIL PROTECTED] wrote:

  Embedding Word/Excel uses a feature of those two products called OLE
  (Object Link Exchange).  Get ready to learn more than you'll wish to
  ever know about COM (Component Object Model).

  I always thought OLE was Object Linking and Embedding.

Yeah, I've never heard any different either. :-)

-- Brett

In the rhythm of music a secret is hidden;
 If I were to divulge it, it would overturn the world.
 -- Jelaleddin Rumi


Re: [c-prog] Need Help

2008-04-23 Thread Thomas Hruska
Brett McCoy wrote:
 On Wed, Apr 23, 2008 at 1:23 PM, ~Rick [EMAIL PROTECTED] wrote:
 
  Embedding Word/Excel uses a feature of those two products called OLE
  (Object Link Exchange).  Get ready to learn more than you'll wish to
  ever know about COM (Component Object Model).

  I always thought OLE was Object Linking and Embedding.
 
 Yeah, I've never heard any different either. :-)
 
 -- Brett

Huh.  You're right.  That's weird.  I must have muddled OLE and DDE 
together and come up with my own acronym expansion.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/



Re: [c-prog] Need help in converting HANDLE to HWND

2008-04-03 Thread Paul Herring
On Thu, Apr 3, 2008 at 6:47 AM, Gopi Krishna Komanduri
[EMAIL PROTECTED] wrote:

  WM_COPYDATA .

http://www.codersource.net/mfc_ipc_wm_copydata.aspx

-- 
PJH

A man in a shellsuit goes into a posh furriers. He says to the shop
assistant I want a coat.
The shop assistant, barely concealing her disdain, asks What fur?
The man replies Fur ma girlfriend.


Re: [c-prog] need help quickly please

2008-03-05 Thread Brett McCoy
On Wed, Mar 5, 2008 at 10:56 AM, zack_of_egypt [EMAIL PROTECTED] wrote:

 I'm a first year student at Cairo university , thanks for ur help
  I need to a code takes an operation an calculate it (op1 operation
  op2)a the prog showa the result then keeps it for the next operation
  the user enter the second operation ( operation op3)and the prog keep
  it again for the next operation.etc


  please I need this code to know how did u do it, becuz I tried to
  write it but it doesn't work I couldn't do it , I've just started
  learning it
  thanks ; please reply quickly

We don't do homework for people. Show us what you have written so far.

-- Brett

In the rhythm of music a secret is hidden;
If I were to divulge it, it would overturn the world.
   -- Jelaleddin Rumi


Re: [c-prog] need help quickly please

2008-03-05 Thread Paul Herring
On Wed, Mar 5, 2008 at 3:56 PM, zack_of_egypt [EMAIL PROTECTED] wrote:
[...]
  please I need this code to know how did u do it, becuz I tried to
  write it but it doesn't work I couldn't do it , I've just started
  learning it
  thanks ; please reply quickly

Please see http://home.att.net/~jackklein/ctips01.html#homework

-- 
PJH

http://shabbleland.myminicity.com


Re: [c-prog] need help quickly please

2008-03-05 Thread Jim Dougherty
If you need a quick response you have chosen the perfect way to get it, however 
you might not get the kind of response that you are looking for.



c-prog@yahoogroups.com wrote:
 I'm a first year student at Cairo university , thanks for ur help
 I need to a code takes an operation an calculate it (op1 operation
 op2)a the prog showa the result then keeps it for the next operation
 the user enter the second operation ( operation op3)and the prog keep
 it again for the next operation.etc
 
 please I need this code to know how did u do it, becuz I tried to
 write it but it doesn't work I couldn't do it , I've just started
 learning it 
 thanks ; please reply quickly
 



[Fwd: Re: [c-prog] need help quickly please (I AM ALIZEE)]

2008-03-05 Thread Jim Dougherty
Alizee,
You need to send this to the cprog list and not to me directly.
Describe the problem that you are having.



 Original Message 
Subject: Re: [c-prog] need help quickly please (I AM ALIZEE)
Date: Wed, 05 Mar 2008 14:53:14 -0500
From: ali senator [EMAIL PROTECTED]
To: Jim Dougherty [EMAIL PROTECTED]

This is calculator for fraction
i hope it will help you..


  
Never
miss a thing. [ http://us.rd.yahoo.com/evt=51438/*http://www.yahoo.com/r/hs ]
Make Yahoo your homepage.#include iostream.h
#include conio.h
struct calculate{
 int up;
 int down;
 char ch;
};
calculate sum(calculate,calculate);
calculate multiple(calculate,calculate);
calculate divid(calculate,calculate);
calculate mines(calculate,calculate);
main(){
 clrscr();
 const int size=3;
 calculate array[size];
 array[0].ch='/';
 array[2].ch='/';
 coutPlease Enter a from (a/b) : ;
 cinarray[0].up;
 coutPlease Enter b from (a/b) : ;
 cinarray[0].down;
 coutPlease Enter c from (c/d) : ;
 cinarray[2].up;
 coutPlease Enter d from (c/d) : ;
 cinarray[2].down;
 coutPlease Enter (+,*,/,-) : ;
 cinarray[1].ch;
 switch(array[1].ch){
 case '+':
 array[1]=sum(array[0],array[2]);
 coutResult Sum Is : array[1].uparray[1].charray[1].down;
 break;
  case '*':
 array[1]=multiple(array[0],array[2]);
 coutResult Multiple Is : array[1].uparray[1].charray[1].down;
 break;
  case '/':
 array[1]=divid(array[0],array[2]);
 coutResult Divid Is : array[1].uparray[1].charray[1].down;
 break;
  case '-':
 array[1]=mines(array[0],array[2]);
 coutResult mines Is : array[1].uparray[1].charray[1].down;
 break;
 default:
 cout!!! WRONG !!!\a;
 }
 getch();
 return 0;
}
int gcd(int unsigned a,int unsigned b){
int max=a;
int min=b;
if (bmax)
{
max=b;
min=a;
}
if (max%min==0)
return min;
for (int i=min;i0;i--){
 if(max%i==0  min%i==0)
  return i;
}
}
calculate sum(calculate a,calculate b){
 calculate c;
 c.up=(a.up*b.down)+(a.down*b.up);
 c.down=(b.down)*(a.down);
 int G=gcd(c.up,c.down);
 c.up/=G;
 c.down/=G;
 c.ch='/';
 return c;
 }
 calculate multiple(calculate a,calculate b){
 calculate c;
 c.up=(a.up*b.up);
 c.down=(b.down)*(a.down);
 int G=gcd(c.up,c.down);
 c.up/=G;
 c.down/=G;
 c.ch='/';
 return c;
 }
 calculate divid(calculate a,calculate b){
 calculate c;
 c.up=(a.up*b.down);
 c.down=(b.up)*(a.down);
 int G=gcd(c.up,c.down);
 c.up/=G;
 c.down/=G;
 c.ch='/';
 return c;
 }
 calculate mines(calculate a,calculate b){
 calculate c;
 c.up=(a.up*b.down)-(a.down*b.up);
 c.down=(b.down)*(a.down);
 int G=gcd(c.up,c.down);
 c.up/=G;
 c.down/=G;
 c.ch='/';
 return c;
 }





Re: [c-prog] Need help sorting an array of structures

2008-01-27 Thread ~Rick
At Friday 1/25/2008 07:55 PM, you wrote:
--- ~Rick [EMAIL PROTECTED] escreveu:

  I am populating a number of entries and want to sort on the field
  linedata.transferPath. I'm using qsort and have built a comparator
  function but cannot figure out how to specify the transferPath
  element.
 
  But, I want to sort on an element within a structure. I've tried, and
  it fails. How can I specify the element to the comparator? (Darn
  pointers!)? I haven't worked with qsort or comparator functions before.
 
  int compareEntry (const void * a, const void * b)
  {
   char *a1= (char *)a;
   char *b1= (char *)b;
   char *a2= a1.transferPath;
   char *b2= b1.transferPath;
 
   return (strcmp((char *)a2, (char *)b2));
  }

   The right code is:

int compareEntry (const void * a, const void * b)
{
  struct ENTRY *e1 = (struct ENTRY*)a;
  struct ENTRY *e2 = (struct ENTRY*)b;
  char *c1  = e1-transferPath;
  char *c2  = e2-transferPath;

  return (strcmp(c1, c2));
}

   You may use typedef struct to do not need to type struct before every
ENTRY.

Thank you. This seems to have done the trick. I 
just couldn't seem to get my thoughts focused enough to get this correct.

I had tried the struct-element as well as 
struct.element formats but couldn't seem to get the right combination.

Thanks again.

~Rick



   Abra sua conta no Yahoo! Mail, o único 
 sem limite de espaço para armazenamento!
http://br.mail.yahoo.com/


To unsubscribe, send a blank message to 
mailto:[EMAIL PROTECTED].
Yahoo! Groups Links






Re: [c-prog] Need help sorting an array of structures

2008-01-27 Thread ~Rick
At Friday 1/25/2008 07:49 PM, you wrote:
~Rick wrote:
  All,
 
  I have a structure defined below (I've eliminated some of the
  elements because it's big). It's setup to be part of a single linked
  list but at the moment I have an array built:
 
  struct ENTRYlinedata[MAX_ENTS];
snip

Use linedata with qsort().  Then, inside the comparison function,
typecast to the structure and extract the element(s) you want to compare
and go from there.


Thomas,

I did use linedata in the qsort call. My problem was trying to get 
the proper typecasts in the comparison function. My brain wasn't 
getting it. It works now.

Thanks,

~Rick


--
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/



To unsubscribe, send a blank message to 
mailto:[EMAIL PROTECTED].
Yahoo! Groups Links






Re: [c-prog] Need help sorting an array of structures

2008-01-25 Thread Thomas Hruska
~Rick wrote:
 All,
 
 I have a structure defined below (I've eliminated some of the 
 elements because it's big). It's setup to be part of a single linked 
 list but at the moment I have an array built:
 
 struct ENTRYlinedata[MAX_ENTS];
snip

Use linedata with qsort().  Then, inside the comparison function, 
typecast to the structure and extract the element(s) you want to compare 
and go from there.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/



Re: [c-prog] Need help sorting an array of structures

2008-01-25 Thread Pedro Izecksohn
--- ~Rick [EMAIL PROTECTED] escreveu:

 I am populating a number of entries and want to sort on the field 
 linedata.transferPath. I'm using qsort and have built a comparator 
 function but cannot figure out how to specify the transferPath 
 element.
 
 But, I want to sort on an element within a structure. I've tried, and 
 it fails. How can I specify the element to the comparator? (Darn 
 pointers!)? I haven't worked with qsort or comparator functions before.
 
 int compareEntry (const void * a, const void * b)
 {
  char *a1= (char *)a;
  char *b1= (char *)b;
  char *a2= a1.transferPath;
  char *b2= b1.transferPath;
 
  return (strcmp((char *)a2, (char *)b2));
 }

  The right code is:

int compareEntry (const void * a, const void * b)
{
 struct ENTRY *e1 = (struct ENTRY*)a;
 struct ENTRY *e2 = (struct ENTRY*)b;
 char *c1  = e1-transferPath;
 char *c2  = e2-transferPath;

 return (strcmp(c1, c2));
}

  You may use typedef struct to do not need to type struct before every
ENTRY.



  Abra sua conta no Yahoo! Mail, o único sem limite de espaço para 
armazenamento!
http://br.mail.yahoo.com/


Re: [c-prog] NEED HELP

2008-01-17 Thread Thomas Hruska
sugam vora wrote:
 dear freinds,
I need C source code for MULTIPLEXER
 pls make it available . . .

Since this doesn't really tell us what you want to do, I refer you to 
the following Wikipedia article:

http://en.wikipedia.org/wiki/Multiplexer

Clarify what you want to do.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/



Re: [c-prog] Need help to list it as range.

2007-12-28 Thread Paul Herring
On Dec 28, 2007 6:06 AM, Nehru [EMAIL PROTECTED] wrote:

 Dear all,

 I'm a beginner in C.

 I've an array which has a set of elements say for example
 23,24,25,34,35,36,37,44,6,7,8,9.

 so i should get the output as
 23-25,34-37,44-44,6-9.

 I tried a little. but i don't know to bring it in the program.
 Can anyone help me?

Print first number.
While (more numbers)
   if next number != last number+1
  print - + last number + , + this number
end
if last number = number before + 1
   print - + last number
else
   print last number
end

There'll be a few cases where this algorithm won't work, but it'll
give you an idea of how to start.

-- 
PJH

http://shabbleland.myminicity.com/


Re: [c-prog] Need help tracking down SegFault

2007-12-16 Thread Michael Sullivan

On Sat, 2007-12-15 at 21:33 -0700, Thomas Hruska wrote:
 Michael Sullivan wrote:
  On Sat, 2007-12-15 at 19:53 +, ed wrote:
  Michael Sullivan wrote:
  OK. I need help tracking down a segmentation fault. The problem is
  that even with the backtrace information from gdb, I'm still not
  exactly
  sure where it is occurring. Here's the backtrace info:
 
  Program received signal SIGSEGV, Segmentation fault.
  [Switching to Thread 0x4000 (LWP 31519)]
  0xb7f2d69c in do_lookup_x () from /lib/ld-linux.so.2
  (gdb) backtrace 
  #0 0xb7f2d69c in do_lookup_x () from /lib/ld-linux.so.2
  #1 0xb7f2da3e in _dl_lookup_symbol_x () from /lib/ld-linux.so.2
  #2 0xb7f317c4 in _dl_fixup () from /lib/ld-linux.so.2
  #3 0xb7f36db0 in _dl_runtime_resolve () from /lib/ld-linux.so.2
  #4 0x08049bd3 in battle::battle ()
  #5 0x0804a09f in main ()
 
  It looks to me like something in my battle constructor is causing
  it,
  but the battle constructor creates four Allies, which makes calls
 to
  Character and the whole thing's a mess. I don't even know what
 code
  to
  post here. I've got the full source code of everything the project
  currently uses at
  http://www.espersunited.com/~michael/needhelp.txt .
  Please help, if you can. If there's any other information I can
  provide
  that would be useful, please let me know...
 
 
  Set a break point on the constructor and step in.
 
  [Non-text portions of this message have been removed]
  
  Can anyone inform me on how to do that with gdb? Here's my attempt:
  
  [EMAIL PROTECTED] ourrpg $ gdb battle
  GNU gdb 6.7.1
  Copyright (C) 2007 Free Software Foundation, Inc.
  License GPLv3+: GNU GPL version 3 or later
  http://gnu.org/licenses/gpl.html
  This is free software: you are free to change and redistribute it.
  There is NO WARRANTY, to the extent permitted by law. Type show
  copying
  and show warranty for details.
  This GDB was configured as i686-pc-linux-gnu...
  Using host libthread_db library /lib/libthread_db.so.1.
  (gdb) b battle::battle()
  Breakpoint 1 at 0x804a3a6
  (gdb) r
  Starting program: /home/michael/ourrpg/battle 
  [Thread debugging using libthread_db enabled]
  [New Thread 0x4000 (LWP 31855)]
  
  Program received signal SIGSEGV, Segmentation fault.
  [Switching to Thread 0x4000 (LWP 31855)]
  0xb7fd969c in do_lookup_x () from /lib/ld-linux.so.2
  (gdb) 
 
 You should seriously consider using an IDE such as KDevelop:
 
 http://www.kdevelop.org/
 
 KDevelop uses gdb behind the scenes for debugging without displaying
 the 
 ugly nitty-gritty details. However, while gdb works fine for C, VC++ 
 has the far superior C++ debugger. Even then, using command-line gdb 
 isn't really all that useful. Use tools (such as KDevelop) that help 
 you write better code faster even if they aren't as pure or noble
 as 
 the command-line.
 
 I may take a look at the source code later.
 
 -- 
 Thomas Hruska
 CubicleSoft President
 Ph: 517-803-4197

I used to (try to) use KDevelop a lot when I first started using Linux.
I could never get simple Hello World type programs to compile.  I try it
again every few years, and it still doesn't work.  That's why I don't
use KDevelop.



Re: [c-prog] Need help tracking down SegFault

2007-12-16 Thread Thomas Hruska
Michael Sullivan wrote:
 OK.  I need help tracking down a segmentation fault.  The problem is
 that even with the backtrace information from gdb, I'm still not exactly
 sure where it is occurring.  Here's the backtrace info:
 
 Program received signal SIGSEGV, Segmentation fault.
 [Switching to Thread 0x4000 (LWP 31519)]
 0xb7f2d69c in do_lookup_x () from /lib/ld-linux.so.2
 (gdb) backtrace 
 #0  0xb7f2d69c in do_lookup_x () from /lib/ld-linux.so.2
 #1  0xb7f2da3e in _dl_lookup_symbol_x () from /lib/ld-linux.so.2
 #2  0xb7f317c4 in _dl_fixup () from /lib/ld-linux.so.2
 #3  0xb7f36db0 in _dl_runtime_resolve () from /lib/ld-linux.so.2
 #4  0x08049bd3 in battle::battle ()
 #5  0x0804a09f in main ()
 
 It looks to me like something in my battle constructor is causing it,
 but the battle constructor creates four Allies, which makes calls to
 Character and the whole thing's a mess.  I don't even know what code to
 post here.  I've got the full source code of everything the project
 currently uses at http://www.espersunited.com/~michael/needhelp.txt .
 Please help, if you can.  If there's any other information I can provide
 that would be useful, please let me know...

I took a look at the source.  IMO, you are doing WAY too much in the 
constructors.  A _LOT_ of stuff can fail.  Library calls that can fail 
should be reserved for a call to your own initialization function AFTER 
construction.  I like to use Init().  Constructors should be fairly 
lightweight (just initialize variables).


battle mybattle = battle();

That line is unnecessary and is probably the cause of your problems. 
Just do:

battle mybattle;

The code before was creating a battle structure (mybattle).  Then it 
created a second battle structure (temporary object).  Then it called 
the default assignment operator, which did a surface copy of the 
temporary object to mybattle.  Then the temporary object was deleted 
(destructor called) which made all the mybattle pointers _invalid_ 
because they are just ordinary pointers _copied_ from the temporary 
object.  Attempting to use the invalid pointers is probably what caused 
the application to crash.

I highly recommend reading Safe C++ Design Principles.  Particularly the 
sections involving smart pointers.  Pretty sure I included source code 
to a fully functional smart pointer.  The C++ compiler is smart enough 
to know how to do a deep copy BUT only if every single variable in the 
class is either a C++ class, template, or a base data type other than a 
pointer and all those know how to do deep copies as well.

I'd like to take this time to point out that you've got your graphics 
engine (including initialization and shutdown) tied directly into a 
class that apparently will manage battles.  These are, IMO, two separate 
logic units that should be treated as such.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/



Re: [c-prog] Need help tracking down SegFault

2007-12-16 Thread Thomas Hruska
Michael Sullivan wrote:
 I used to (try to) use KDevelop a lot when I first started using Linux.
 I could never get simple Hello World type programs to compile.  I try it
 again every few years, and it still doesn't work.  That's why I don't
 use KDevelop.

Given that it is a very popular development tool on the Linux platform 
should be an indicator of pilot error.  You could always use their web 
forum to ask questions:

http://www.kdevelop.org/phorum5/

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/



Re: [c-prog] Need help tracking down SegFault

2007-12-16 Thread Michael Sullivan
On Sun, 2007-12-16 at 06:34 -0700, Thomas Hruska wrote:
 Michael Sullivan wrote:
  OK. I need help tracking down a segmentation fault. The problem is
  that even with the backtrace information from gdb, I'm still not
 exactly
  sure where it is occurring. Here's the backtrace info:
  
  Program received signal SIGSEGV, Segmentation fault.
  [Switching to Thread 0x4000 (LWP 31519)]
  0xb7f2d69c in do_lookup_x () from /lib/ld-linux.so.2
  (gdb) backtrace 
  #0 0xb7f2d69c in do_lookup_x () from /lib/ld-linux.so.2
  #1 0xb7f2da3e in _dl_lookup_symbol_x () from /lib/ld-linux.so.2
  #2 0xb7f317c4 in _dl_fixup () from /lib/ld-linux.so.2
  #3 0xb7f36db0 in _dl_runtime_resolve () from /lib/ld-linux.so.2
  #4 0x08049bd3 in battle::battle ()
  #5 0x0804a09f in main ()
  
  It looks to me like something in my battle constructor is causing
 it,
  but the battle constructor creates four Allies, which makes calls to
  Character and the whole thing's a mess. I don't even know what code
 to
  post here. I've got the full source code of everything the project
  currently uses at
 http://www.espersunited.com/~michael/needhelp.txt .
  Please help, if you can. If there's any other information I can
 provide
  that would be useful, please let me know...
 
 I took a look at the source. IMO, you are doing WAY too much in the 
 constructors. A _LOT_ of stuff can fail. Library calls that can fail 
 should be reserved for a call to your own initialization function
 AFTER 
 construction. I like to use Init(). Constructors should be fairly 
 lightweight (just initialize variables).
 
 battle mybattle = battle();
 
 That line is unnecessary and is probably the cause of your problems. 
 Just do:
 
 battle mybattle;
 
 The code before was creating a battle structure (mybattle). Then it 
 created a second battle structure (temporary object). Then it called 
 the default assignment operator, which did a surface copy of the 
 temporary object to mybattle. Then the temporary object was deleted 
 (destructor called) which made all the mybattle pointers _invalid_ 
 because they are just ordinary pointers _copied_ from the temporary 
 object. Attempting to use the invalid pointers is probably what
 caused 
 the application to crash.
 
 I highly recommend reading Safe C++ Design Principles. Particularly
 the 
 sections involving smart pointers. Pretty sure I included source code 
 to a fully functional smart pointer. The C++ compiler is smart enough 
 to know how to do a deep copy BUT only if every single variable in
 the 
 class is either a C++ class, template, or a base data type other than
 a 
 pointer and all those know how to do deep copies as well.
 
I was poking around the Files section yesterday and noticed that the
Safe C++ book is still an .exe.  
 I'd like to take this time to point out that you've got your graphics 
 engine (including initialization and shutdown) tied directly into a 
 class that apparently will manage battles. These are, IMO, two
 separate 
 logic units that should be treated as such.
 
 -- 
 Thomas Hruska
 CubicleSoft President
 Ph: 517-803-4197
 
 *NEW* MyTaskFocus 1.1
 Get on task. Stay on task.
 
 http://www.CubicleSoft.com/MyTaskFocus/
 
 
 
 
  



Re: [c-prog] Need help tracking down SegFault

2007-12-16 Thread Thomas Hruska
Michael Sullivan wrote:
 I was poking around the Files section yesterday and noticed that the
 Safe C++ book is still an .exe.  

That would be because Second Edition hasn't been released yet.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/



Re: [c-prog] Need help tracking down SegFault

2007-12-16 Thread Brett McCoy
On Dec 16, 2007 9:03 AM, Michael Sullivan [EMAIL PROTECTED] wrote:

 I was poking around the Files section yesterday and noticed that the
 Safe C++ book is still an .exe.

It can be installed with Wine. It's only a PDF so once it's installed
it can be read with the Linux version of Acrobat (or any other PDF
reader).

-- Brett

In the rhythm of music a secret is hidden;
If I were to divulge it, it would overturn the world.
   -- Jelaleddin Rumi


Re: [c-prog] Need help tracking down SegFault

2007-12-16 Thread ed
Thomas Hruska wrote:
 Michael Sullivan wrote:
 On Sat, 2007-12-15 at 19:53 +, ed wrote:
 Michael Sullivan wrote:
 OK. I need help tracking down a segmentation fault. The problem is
 that even with the backtrace information from gdb, I'm still not
 exactly
 sure where it is occurring. Here's the backtrace info:

 Program received signal SIGSEGV, Segmentation fault.
 [Switching to Thread 0x4000 (LWP 31519)]
 0xb7f2d69c in do_lookup_x () from /lib/ld-linux.so.2
 (gdb) backtrace 
 #0 0xb7f2d69c in do_lookup_x () from /lib/ld-linux.so.2
 #1 0xb7f2da3e in _dl_lookup_symbol_x () from /lib/ld-linux.so.2
 #2 0xb7f317c4 in _dl_fixup () from /lib/ld-linux.so.2
 #3 0xb7f36db0 in _dl_runtime_resolve () from /lib/ld-linux.so.2
 #4 0x08049bd3 in battle::battle ()
 #5 0x0804a09f in main ()

 It looks to me like something in my battle constructor is causing
 it,
 but the battle constructor creates four Allies, which makes calls to
 Character and the whole thing's a mess. I don't even know what code
 to
 post here. I've got the full source code of everything the project
 currently uses at
 http://www.espersunited.com/~michael/needhelp.txt .
 Please help, if you can. If there's any other information I can
 provide
 that would be useful, please let me know...


 Set a break point on the constructor and step in.

 [Non-text portions of this message have been removed]
 Can anyone inform me on how to do that with gdb?  Here's my attempt:

 [EMAIL PROTECTED] ourrpg $ gdb battle
 GNU gdb 6.7.1
 Copyright (C) 2007 Free Software Foundation, Inc.
 License GPLv3+: GNU GPL version 3 or later
 http://gnu.org/licenses/gpl.html
 This is free software: you are free to change and redistribute it.
 There is NO WARRANTY, to the extent permitted by law.  Type show
 copying
 and show warranty for details.
 This GDB was configured as i686-pc-linux-gnu...
 Using host libthread_db library /lib/libthread_db.so.1.
 (gdb) b battle::battle()
 Breakpoint 1 at 0x804a3a6
 (gdb) r
 Starting program: /home/michael/ourrpg/battle 
 [Thread debugging using libthread_db enabled]
 [New Thread 0x4000 (LWP 31855)]

 Program received signal SIGSEGV, Segmentation fault.
 [Switching to Thread 0x4000 (LWP 31855)]
 0xb7fd969c in do_lookup_x () from /lib/ld-linux.so.2
 (gdb) 
 
 You should seriously consider using an IDE such as KDevelop:
 
 http://www.kdevelop.org/
 
 KDevelop uses gdb behind the scenes for debugging without displaying the 
 ugly nitty-gritty details.  However, while gdb works fine for C, VC++ 
 has the far superior C++ debugger.  Even then, using command-line gdb 
 isn't really all that useful.  Use tools (such as KDevelop) that help 
 you write better code faster even if they aren't as pure or noble as 
 the command-line.
 
 I may take a look at the source code later.
 

Bah!

nvi, gcc and gdb for eva.

Seriously, relying on kdevelop is not a good way to start out. The last
thing the world needs is another drag and drop programmer. When things
go tits up, success favours those who know what they're doing.

A little knowledge of things like buffer over flows saves us many exploits.





[Non-text portions of this message have been removed]



Re: [c-prog] Need help tracking down SegFault

2007-12-16 Thread Thomas Hruska
ed wrote:
 Thomas Hruska wrote:
 You should seriously consider using an IDE such as KDevelop:

 http://www.kdevelop.org/

 KDevelop uses gdb behind the scenes for debugging without displaying the 
 ugly nitty-gritty details.  However, while gdb works fine for C, VC++ 
 has the far superior C++ debugger.  Even then, using command-line gdb 
 isn't really all that useful.  Use tools (such as KDevelop) that help 
 you write better code faster even if they aren't as pure or noble as 
 the command-line.

 I may take a look at the source code later.

 
 Bah!
 
 nvi, gcc and gdb for eva.
 
 Seriously, relying on kdevelop is not a good way to start out. The last
 thing the world needs is another drag and drop programmer. When things
 go tits up, success favours those who know what they're doing.

I disagree wholeheartedly.  Using the command-line to build software is 
good for exactly one type of software program:  A hi there program to 
make sure everything is in working order.  Knowing _how_ to use the 
command-line compiler is good enough.  After that, head off to the IDE 
and let it manage your software projects, using Google to hunt down 
weird problems.


 A little knowledge of things like buffer over flows saves us many exploits.

That has absolutely nothing to do with using an IDE or the command-line. 
  There is no correlation.  Bad programmers use gcc (or IDEs) just as 
well as good programmers.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/



Re: [c-prog] Need help tracking down SegFault

2007-12-16 Thread Michael Sullivan

On Sun, 2007-12-16 at 09:02 -0700, Thomas Hruska wrote:
 ed wrote:
  Thomas Hruska wrote:
  You should seriously consider using an IDE such as KDevelop:
 
  http://www.kdevelop.org/
 
  KDevelop uses gdb behind the scenes for debugging without
 displaying the 
  ugly nitty-gritty details. However, while gdb works fine for C, VC
 ++ 
  has the far superior C++ debugger. Even then, using command-line
 gdb 
  isn't really all that useful. Use tools (such as KDevelop) that
 help 
  you write better code faster even if they aren't as pure or
 noble as 
  the command-line.
 
  I may take a look at the source code later.
 
  
  Bah!
  
  nvi, gcc and gdb for eva.
  
  Seriously, relying on kdevelop is not a good way to start out. The
 last
  thing the world needs is another drag and drop programmer. When
 things
  go tits up, success favours those who know what they're doing.
 
 I disagree wholeheartedly. Using the command-line to build software
 is 
 good for exactly one type of software program: A hi there program
 to 
 make sure everything is in working order. Knowing _how_ to use the 
 command-line compiler is good enough. After that, head off to the IDE 
 and let it manage your software projects, using Google to hunt down 
 weird problems.
 
  A little knowledge of things like buffer over flows saves us many
 exploits.
 
 That has absolutely nothing to do with using an IDE or the
 command-line. 
 There is no correlation. Bad programmers use gcc (or IDEs) just as 
 well as good programmers.

Well, all I know is that I started a new KDevelop project (simple SDL),
created empty files and copied my original source code into the empty
files (I don't want KDevelop messing with my original files.)  I then
asked to build the project.  It generated about ten kazillion errors.
Things like #include statement nested too far in, whatever that means.
The project built just fine with my original files on the command line.
It creates a battle executable.  When I try to debug it though, I ask
for a breakpoint on battle::battle() and it claims to comply, but when I
run it, it goes right past without stopping.  When I ask for a
breakpoint on battle.cpp:13 it claims that it doesn't know about
battle.cpp.  And when I try to issue a list command, it says something
about files that don't exist.  Specifically, temporary portage build
files.  I know that's a Gentoo-specific problem, but I can't continue
working on this project until I track down this SegFault...




Re: [c-prog] Need help tracking down SegFault

2007-12-16 Thread Thomas Hruska
Michael Sullivan wrote:
 On Sun, 2007-12-16 at 09:02 -0700, Thomas Hruska wrote:
 ed wrote:
 Thomas Hruska wrote:
 You should seriously consider using an IDE such as KDevelop:

 http://www.kdevelop.org/

 KDevelop uses gdb behind the scenes for debugging without
 displaying the 
 ugly nitty-gritty details. However, while gdb works fine for C, VC
 ++ 
 has the far superior C++ debugger. Even then, using command-line
 gdb 
 isn't really all that useful. Use tools (such as KDevelop) that
 help 
 you write better code faster even if they aren't as pure or
 noble as 
 the command-line.

 I may take a look at the source code later.

 Bah!

 nvi, gcc and gdb for eva.

 Seriously, relying on kdevelop is not a good way to start out. The
 last
 thing the world needs is another drag and drop programmer. When
 things
 go tits up, success favours those who know what they're doing.
 I disagree wholeheartedly. Using the command-line to build software
 is 
 good for exactly one type of software program: A hi there program
 to 
 make sure everything is in working order. Knowing _how_ to use the 
 command-line compiler is good enough. After that, head off to the IDE 
 and let it manage your software projects, using Google to hunt down 
 weird problems.

 A little knowledge of things like buffer over flows saves us many
 exploits.

 That has absolutely nothing to do with using an IDE or the
 command-line. 
 There is no correlation. Bad programmers use gcc (or IDEs) just as 
 well as good programmers.
 
 Well, all I know is that I started a new KDevelop project (simple SDL),
 created empty files and copied my original source code into the empty
 files (I don't want KDevelop messing with my original files.)  I then
 asked to build the project.  It generated about ten kazillion errors.
 Things like #include statement nested too far in, whatever that means.

Do something simple first with the IDE and get that working.  The 
KDevelop website has step-by-step tutorials to get you up and running. 
Don't just dump in a project that doesn't work properly in the first 
place and expect it to work when you don't know the first thing about 
the IDE.  If you've never _used_ an IDE before, it takes a bit to get 
acquainted with but is, IMO, worth the effort.

And KDevelop isn't the only IDE out there for Linux.  Some people prefer 
others like Anjuta.  Just find one with a good debugging interface.

IMO, a game is not a good first C++ project to tackle while learning the 
language.  Games require..finesse.


 The project built just fine with my original files on the command line.
 It creates a battle executable.  When I try to debug it though, I ask

Clarify your pronouns.

It being which - KDevelop executing gcc or command-line gcc?


 for a breakpoint on battle::battle() and it claims to comply, but when I

It being which - KDevelop or gdb?  As I said before, gdb works fine 
with C code but apparently doesn't work so well with C++ (VC++ has the 
superior debugger when it comes to stepping through C++ code).  KDevelop 
uses gdb behind the scenes...


 run it, it goes right past without stopping.  When I ask for a
 breakpoint on battle.cpp:13 it claims that it doesn't know about
 battle.cpp.  And when I try to issue a list command, it says something
 about files that don't exist.  Specifically, temporary portage build
 files.  I know that's a Gentoo-specific problem, but I can't continue
 working on this project until I track down this SegFault...

KDevelop setup-specific issues should probably be directed at their web 
forum.  And you should really go through their tutorials.  A pain, I 
know, but probably necessary.  Either that or find someone you know who 
also knows how to use KDevelop to show you the ropes.

I gave you a pretty good starting point to look into a few posts back 
that would have been a major cause of crashing issues.  Did you try the 
suggested fix?

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/



Re: [c-prog] Need help tracking down SegFault

2007-12-16 Thread Michael Sullivan

On Sun, 2007-12-16 at 12:59 -0700, Thomas Hruska wrote:
 Michael Sullivan wrote:
  On Sun, 2007-12-16 at 09:02 -0700, Thomas Hruska wrote:
  ed wrote:
  Thomas Hruska wrote:
  You should seriously consider using an IDE such as KDevelop:
 
  http://www.kdevelop.org/
 
  KDevelop uses gdb behind the scenes for debugging without
  displaying the 
  ugly nitty-gritty details. However, while gdb works fine for C,
 VC
  ++ 
  has the far superior C++ debugger. Even then, using command-line
  gdb 
  isn't really all that useful. Use tools (such as KDevelop) that
  help 
  you write better code faster even if they aren't as pure or
  noble as 
  the command-line.
 
  I may take a look at the source code later.
 
  Bah!
 
  nvi, gcc and gdb for eva.
 
  Seriously, relying on kdevelop is not a good way to start out. The
  last
  thing the world needs is another drag and drop programmer. When
  things
  go tits up, success favours those who know what they're doing.
  I disagree wholeheartedly. Using the command-line to build software
  is 
  good for exactly one type of software program: A hi there program
  to 
  make sure everything is in working order. Knowing _how_ to use the 
  command-line compiler is good enough. After that, head off to the
 IDE 
  and let it manage your software projects, using Google to hunt
 down 
  weird problems.
 
  A little knowledge of things like buffer over flows saves us many
  exploits.
 
  That has absolutely nothing to do with using an IDE or the
  command-line. 
  There is no correlation. Bad programmers use gcc (or IDEs) just as 
  well as good programmers.
  
  Well, all I know is that I started a new KDevelop project (simple
 SDL),
  created empty files and copied my original source code into the
 empty
  files (I don't want KDevelop messing with my original files.) I then
  asked to build the project. It generated about ten kazillion errors.
  Things like #include statement nested too far in, whatever that
 means.
 
 Do something simple first with the IDE and get that working. The 
 KDevelop website has step-by-step tutorials to get you up and
 running. 
 Don't just dump in a project that doesn't work properly in the first 
 place and expect it to work when you don't know the first thing about 
 the IDE. If you've never _used_ an IDE before, it takes a bit to get 
 acquainted with but is, IMO, worth the effort.
 
 And KDevelop isn't the only IDE out there for Linux. Some people
 prefer 
 others like Anjuta. Just find one with a good debugging interface.
 
 IMO, a game is not a good first C++ project to tackle while learning
 the 
 language. Games require..finesse.
 
  The project built just fine with my original files on the command
 line.
  It creates a battle executable. When I try to debug it though, I ask
 
 Clarify your pronouns.
 
 It being which - KDevelop executing gcc or command-line gcc?
 
  for a breakpoint on battle::battle() and it claims to comply, but
 when I
 
 It being which - KDevelop or gdb? As I said before, gdb works fine 
 with C code but apparently doesn't work so well with C++ (VC++ has
 the 
 superior debugger when it comes to stepping through C++ code).
 KDevelop 
 uses gdb behind the scenes...
 
  run it, it goes right past without stopping. When I ask for a
  breakpoint on battle.cpp:13 it claims that it doesn't know about
  battle.cpp. And when I try to issue a list command, it says
 something
  about files that don't exist. Specifically, temporary portage build
  files. I know that's a Gentoo-specific problem, but I can't continue
  working on this project until I track down this SegFault...
 
 KDevelop setup-specific issues should probably be directed at their
 web 
 forum. And you should really go through their tutorials. A pain, I 
 know, but probably necessary. Either that or find someone you know
 who 
 also knows how to use KDevelop to show you the ropes.
 
 I gave you a pretty good starting point to look into a few posts back 
 that would have been a major cause of crashing issues. Did you try
 the 
 suggested fix?
 
 -- 
 Thomas Hruska
 CubicleSoft President
 Ph: 517-803-4197
 
 *NEW* MyTaskFocus 1.1
 Get on task. Stay on task.
 
 http://www.CubicleSoft.com/MyTaskFocus/

Look.  I'll make this very, very simple.  I DO NOT want to use KDevelop.
I use gvim.  When I wrote my original source code files, they (the
original files) compile just fine while running make at the command
line.  I am trying to find the source of the segmentation fault.  And
for your information, this is not my first C++ project.  I've had
numerous university classes on programming using C++.  I'm trying very
hard not to be insulting, but it's very difficult as you seem to think
that I'm an imbecile and that I can't do this.



Re: [c-prog] Need help tracking down SegFault

2007-12-16 Thread Thomas Hruska
Michael Sullivan wrote:
 Look.  I'll make this very, very simple.  I DO NOT want to use KDevelop.
 I use gvim.  When I wrote my original source code files, they (the
 original files) compile just fine while running make at the command
 line.  I am trying to find the source of the segmentation fault.  And
 for your information, this is not my first C++ project.  I've had
 numerous university classes on programming using C++.  I'm trying very
 hard not to be insulting, but it's very difficult as you seem to think
 that I'm an imbecile and that I can't do this.

Fine.  Did you TRY my suggested fix?  You haven't answered me either way.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/



Re: [c-prog] Need help tracking down SegFault

2007-12-16 Thread Thomas Hruska
Thomas Hruska wrote:
 Michael Sullivan wrote:
 Look.  I'll make this very, very simple.  I DO NOT want to use KDevelop.
 I use gvim.  When I wrote my original source code files, they (the
 original files) compile just fine while running make at the command
 line.  I am trying to find the source of the segmentation fault.  And
 for your information, this is not my first C++ project.  I've had
 numerous university classes on programming using C++.  I'm trying very
 hard not to be insulting, but it's very difficult as you seem to think
 that I'm an imbecile and that I can't do this.
 
 Fine.  Did you TRY my suggested fix?  You haven't answered me either way.

Found one more crash location:  currentrect is never allocated (and also 
not deallocated).  The big crash bug though is the mybattle one.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/



Re: [c-prog] Need help tracking down SegFault

2007-12-16 Thread Thomas Hruska
Thomas Hruska wrote:
 Michael Sullivan wrote:
 Look.  I'll make this very, very simple.  I DO NOT want to use KDevelop.
 I use gvim.  When I wrote my original source code files, they (the
 original files) compile just fine while running make at the command
 line.  I am trying to find the source of the segmentation fault.  And
 for your information, this is not my first C++ project.  I've had
 numerous university classes on programming using C++.  I'm trying very
 hard not to be insulting, but it's very difficult as you seem to think
 that I'm an imbecile and that I can't do this.
 
 Fine.  Did you TRY my suggested fix?  You haven't answered me either way.

If all of my suggestions still fail, you may have improperly installed 
SDL.  Your gdb backtrace says it is a bad runtime resolution (a pretty 
rare circumstance - to have a good compile and link followed by bad 
runtime resolution).  But you do have multiple crash bugs in your source 
and what with tossing around two initializations of the same SDL library 
and referencing who knows what will result in pretty much anything 
happening.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/



Re: [c-prog] Need help tracking down SegFault

2007-12-16 Thread Michael Sullivan
On Sun, 2007-12-16 at 13:46 -0700, Thomas Hruska wrote:
 Michael Sullivan wrote:
  Look. I'll make this very, very simple. I DO NOT want to use
 KDevelop.
  I use gvim. When I wrote my original source code files, they (the
  original files) compile just fine while running make at the command
  line. I am trying to find the source of the segmentation fault. And
  for your information, this is not my first C++ project. I've had
  numerous university classes on programming using C++. I'm trying
 very
  hard not to be insulting, but it's very difficult as you seem to
 think
  that I'm an imbecile and that I can't do this.
 
 Fine. Did you TRY my suggested fix? You haven't answered me either
 way.
 
Yes.  I changed Battle mybattle = Battle() to Battle mybattle this
morning.  If it had worked, I would have said so.
 -- 
 Thomas Hruska
 CubicleSoft President
 Ph: 517-803-4197





Re: [c-prog] Need help tracking down SegFault

2007-12-15 Thread ed
Michael Sullivan wrote:
 OK.  I need help tracking down a segmentation fault.  The problem is
 that even with the backtrace information from gdb, I'm still not exactly
 sure where it is occurring.  Here's the backtrace info:
 
 Program received signal SIGSEGV, Segmentation fault.
 [Switching to Thread 0x4000 (LWP 31519)]
 0xb7f2d69c in do_lookup_x () from /lib/ld-linux.so.2
 (gdb) backtrace 
 #0  0xb7f2d69c in do_lookup_x () from /lib/ld-linux.so.2
 #1  0xb7f2da3e in _dl_lookup_symbol_x () from /lib/ld-linux.so.2
 #2  0xb7f317c4 in _dl_fixup () from /lib/ld-linux.so.2
 #3  0xb7f36db0 in _dl_runtime_resolve () from /lib/ld-linux.so.2
 #4  0x08049bd3 in battle::battle ()
 #5  0x0804a09f in main ()
 
 It looks to me like something in my battle constructor is causing it,
 but the battle constructor creates four Allies, which makes calls to
 Character and the whole thing's a mess.  I don't even know what code to
 post here.  I've got the full source code of everything the project
 currently uses at http://www.espersunited.com/~michael/needhelp.txt .
 Please help, if you can.  If there's any other information I can provide
 that would be useful, please let me know...
 
 

Set a break point on the constructor and step in.




[Non-text portions of this message have been removed]



Re: [c-prog] Need help tracking down SegFault

2007-12-15 Thread Michael Sullivan
On Sat, 2007-12-15 at 19:53 +, ed wrote:
 Michael Sullivan wrote:
  OK. I need help tracking down a segmentation fault. The problem is
  that even with the backtrace information from gdb, I'm still not
 exactly
  sure where it is occurring. Here's the backtrace info:
  
  Program received signal SIGSEGV, Segmentation fault.
  [Switching to Thread 0x4000 (LWP 31519)]
  0xb7f2d69c in do_lookup_x () from /lib/ld-linux.so.2
  (gdb) backtrace 
  #0 0xb7f2d69c in do_lookup_x () from /lib/ld-linux.so.2
  #1 0xb7f2da3e in _dl_lookup_symbol_x () from /lib/ld-linux.so.2
  #2 0xb7f317c4 in _dl_fixup () from /lib/ld-linux.so.2
  #3 0xb7f36db0 in _dl_runtime_resolve () from /lib/ld-linux.so.2
  #4 0x08049bd3 in battle::battle ()
  #5 0x0804a09f in main ()
  
  It looks to me like something in my battle constructor is causing
 it,
  but the battle constructor creates four Allies, which makes calls to
  Character and the whole thing's a mess. I don't even know what code
 to
  post here. I've got the full source code of everything the project
  currently uses at
 http://www.espersunited.com/~michael/needhelp.txt .
  Please help, if you can. If there's any other information I can
 provide
  that would be useful, please let me know...
  
  
 
 Set a break point on the constructor and step in.
 
 [Non-text portions of this message have been removed]

Can anyone inform me on how to do that with gdb?  Here's my attempt:

[EMAIL PROTECTED] ourrpg $ gdb battle
GNU gdb 6.7.1
Copyright (C) 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type show
copying
and show warranty for details.
This GDB was configured as i686-pc-linux-gnu...
Using host libthread_db library /lib/libthread_db.so.1.
(gdb) b battle::battle()
Breakpoint 1 at 0x804a3a6
(gdb) r
Starting program: /home/michael/ourrpg/battle 
[Thread debugging using libthread_db enabled]
[New Thread 0x4000 (LWP 31855)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x4000 (LWP 31855)]
0xb7fd969c in do_lookup_x () from /lib/ld-linux.so.2
(gdb) 




Re: [c-prog] Need help tracking down SegFault

2007-12-15 Thread Thomas Hruska
Michael Sullivan wrote:
 On Sat, 2007-12-15 at 19:53 +, ed wrote:
 Michael Sullivan wrote:
 OK. I need help tracking down a segmentation fault. The problem is
 that even with the backtrace information from gdb, I'm still not
 exactly
 sure where it is occurring. Here's the backtrace info:

 Program received signal SIGSEGV, Segmentation fault.
 [Switching to Thread 0x4000 (LWP 31519)]
 0xb7f2d69c in do_lookup_x () from /lib/ld-linux.so.2
 (gdb) backtrace 
 #0 0xb7f2d69c in do_lookup_x () from /lib/ld-linux.so.2
 #1 0xb7f2da3e in _dl_lookup_symbol_x () from /lib/ld-linux.so.2
 #2 0xb7f317c4 in _dl_fixup () from /lib/ld-linux.so.2
 #3 0xb7f36db0 in _dl_runtime_resolve () from /lib/ld-linux.so.2
 #4 0x08049bd3 in battle::battle ()
 #5 0x0804a09f in main ()

 It looks to me like something in my battle constructor is causing
 it,
 but the battle constructor creates four Allies, which makes calls to
 Character and the whole thing's a mess. I don't even know what code
 to
 post here. I've got the full source code of everything the project
 currently uses at
 http://www.espersunited.com/~michael/needhelp.txt .
 Please help, if you can. If there's any other information I can
 provide
 that would be useful, please let me know...


 Set a break point on the constructor and step in.

 [Non-text portions of this message have been removed]
 
 Can anyone inform me on how to do that with gdb?  Here's my attempt:
 
 [EMAIL PROTECTED] ourrpg $ gdb battle
 GNU gdb 6.7.1
 Copyright (C) 2007 Free Software Foundation, Inc.
 License GPLv3+: GNU GPL version 3 or later
 http://gnu.org/licenses/gpl.html
 This is free software: you are free to change and redistribute it.
 There is NO WARRANTY, to the extent permitted by law.  Type show
 copying
 and show warranty for details.
 This GDB was configured as i686-pc-linux-gnu...
 Using host libthread_db library /lib/libthread_db.so.1.
 (gdb) b battle::battle()
 Breakpoint 1 at 0x804a3a6
 (gdb) r
 Starting program: /home/michael/ourrpg/battle 
 [Thread debugging using libthread_db enabled]
 [New Thread 0x4000 (LWP 31855)]
 
 Program received signal SIGSEGV, Segmentation fault.
 [Switching to Thread 0x4000 (LWP 31855)]
 0xb7fd969c in do_lookup_x () from /lib/ld-linux.so.2
 (gdb) 

You should seriously consider using an IDE such as KDevelop:

http://www.kdevelop.org/

KDevelop uses gdb behind the scenes for debugging without displaying the 
ugly nitty-gritty details.  However, while gdb works fine for C, VC++ 
has the far superior C++ debugger.  Even then, using command-line gdb 
isn't really all that useful.  Use tools (such as KDevelop) that help 
you write better code faster even if they aren't as pure or noble as 
the command-line.

I may take a look at the source code later.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/



Re: [c-prog] need help on sscanf()

2007-12-12 Thread Brett McCoy
On Dec 12, 2007 8:54 PM, mano M [EMAIL PROTECTED] wrote:

 i need to use %s and %d in sscanf function. It is not actually working as I 
 expected .I simulated the issue using a sample program.

   #includestdio.h
 int main()
 {
 char str[100]=hello|67;
 char s1[10];
 int num;
 sscanf(str,%s|%d,s1,num);
 printf(%s,s1);
 }

   output: hello|67

I don't think sscanf will parse string like that without whitespace,
it's going to read the entire string at once. I think strtok() will
work better for splitting the string on the | character.

-- Brett

In the rhythm of music a secret is hidden;
If I were to divulge it, it would overturn the world.
   -- Jelaleddin Rumi


Re: [c-prog] Need help

2007-12-01 Thread Brett McCoy
On Dec 1, 2007 7:14 AM, Abhaya Patra. [EMAIL PROTECTED] wrote:

   Can someone please send me one demo project on C++ in Unix environment.
   That will be very useful for me.
   Waiting for your kind cooperation.

Take a look on freshmeat.net, thousands of projects, most open source.

-- Brett

In the rhythm of music a secret is hidden;
If I were to divulge it, it would overturn the world.
   -- Jelaleddin Rumi


Re: [c-prog] Need help

2007-12-01 Thread Thomas Hruska
Abhaya Patra. wrote:
 Hi ,

   Can someone please send me one demo project on C++ in Unix environment.
   That will be very useful for me.
   Waiting for your kind cooperation.

   Thanks,
   Abhaya.

int main(void)
{
   return 0;
}

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/



Re: [c-prog] Need help

2007-12-01 Thread Thomas Hruska
Abhaya Patra. wrote:
 Hi ,

   Can someone please send me one demo project on C++ in Unix environment.
   That will be very useful for me.
   Waiting for your kind cooperation.

   Thanks,
   Abhaya.

And now on a more serious note:


While it is admirable that you are wanting something to do and want to 
spend your time learning C/C++, c-prog is not here to give you ideas on 
what to do.  The choice of what project to work on next is entirely up 
to you and is completely based on your personal preference, skill set, 
and interests.  The 'Links' section on the c-prog website has an entire 
category called 'Projects':

http://tech.groups.yahoo.com/group/c-prog/links/Projects_001115340703/

The links contained there are useful if you want to learn new skills by 
testing yourself or want to take on a project as a freelancer and get 
paid for work completed or perhaps you are interested in open source 
or...well, the list goes on and on.  And perhaps you fancy developing 
your own software products.

The members of c-prog won't author software for you just because you 
want it.  c-prog demands excellence from its members.  You won't learn 
anything if anyone simply provides you with software/source code.  In 
fact, you will likely become dependent upon the group and a burden to 
other people should you get a programming job.  Today's business world 
demands self-reliance.

Therefore, one of the most critical skills you can develop as a 
programmer is choosing for yourself what projects to work on next and 
how to go about developing those projects.  Figure out what it is that 
interests you most and then pursue the goal you set for yourself.

One thing I do that aids me greatly is keeping a list of things I want 
to do project-wise.  Whenever I come up with an idea for a software 
product, I write it down in that list right away and try to flesh it out 
somewhat so that when I return to it later I can remember why I wrote it 
down.  I also keep track of what I want to do for version releases of my 
current software products.  Basically, this is a living list that 
grows and shrinks over time (but it mostly just grows).

However!  When I add an item to my list, I try to make sure the idea is 
unique in some fashion.  There are so many software products out there 
that already exist that it is fairly pointless to duplicate someone 
else's effort unless there is a very good reason to do so beyond the 
making yet another clone of XYZ reason where the overall software is 
inferior to the product being duplicated.  Just before I go on the 
warpath to developing a new product, I do my homework.  I run hundreds 
of Google queries and visit the most popular software distribution sites 
in an attempt to find an existing product that does what I want to do. 
If it exists, even in a limited fashion, I weigh the effort involved in 
developing a competitive product versus developing other items in my 
list that are truly unique.  I've got about 50 products and product 
ideas at any given time on my list.  And, no, you can't have any of them.

[off-topic]  I've started making living lists for other things as 
well.  For example, Christmas lists have traditionally been a nuisance. 
  I used to get asked for the list and trying to remember on the spot 
what sort of things I wanted always ended up in getting stuff I didn't 
really want.  Now I keep a detailed list as I go along and then siphon 
off a small number of items with a wide variety of price ranges every 
year.  I've tried various tools that do list management (including the 
paper and pencil variety) and, amazingly, a plain ol' text document in 
Notepad works far better than any other mechanism.  [/off-topic]

Examples of the outcome of ideas from my living lists are the very 
products on my website.  VerifyMyPC was born from an idea on that list 
but the first attempt was a complete failure and even the latest version 
still isn't quite what I want it to be but it still works like a charm 
for my needs.  I've already caught Microsoft with its pants down using 
VerifyMyPC.  VerifyMyPC has even been labeled as the poor man's 
tripwire - that is, I accidentally made a lightweight Intrustion 
Detection System - not what it was intended for but some users have 
found it to be an invaluable tool as an IDS system.

Also, keep in mind, that because the market is saturated with software 
products, you probably shouldn't release your version of Tetris just 
because you wrote it.  I have thousands of software programs I've 
written but never released.  If you put your program on the Internet, 
you better be ready and capable of supporting that program.  I have too 
many products as-is.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/



Re: [c-prog] Need help tracking down cause of SegFault

2007-12-01 Thread Brett McCoy
On Dec 1, 2007 5:27 PM, Michael Sullivan [EMAIL PROTECTED] wrote:

 I know that a segmentation fault is the equivalent of a null pointer
 exception in Java, but I don't understand why it's happening here.  My
 full code is posted at
 http://www.espersunited.com/~michael/needhelp.txt .  Basically the
 problem is this:

A segmentation fault can mean you are accessing memory you have no
permission to use, like if you are trying to access memory you have
not allocated (null pointer).

I didn't go through all of your code but a few things stuck out at me.

One thing I recommend is to stop using char * or char[] and use the
C++ string class, it'll eliminate some headaches with strings.

Also, instead of using a plain old array in your battle class, I'd use
a vector or or a list or similar kind of C++ container class, they are
a lot more flexible than plain old arrays, especially when it comes to
adding more entries into it.

Definitely learn how to use a C++ debugger... if using gdb isn't up
your alley, get Eclipse, KDevelop or Anjuta (I am assuming you are on
Linux) and use their graphical debuggers (which probably use gdb
underneath).

 class battle
 {
private:
   Ally party[4];
 };

 battle::battle()
 {
party[0] = Ally(Michael, 10, 7);
party[1] = Ally(Amy, 8, 13);
party[2] = Ally(Feli, 12, 15);
party[3] = Ally(Imp, 9, 4);
 }

 class Ally : public Character
 {
public:
   Ally(){}
   Ally(char*, long, long);
   ~Ally();
 };

 Ally::Ally(char* myname, long h, long m) : Character(myname, h, m)
 {
 printf(Arrived in Ally constructor for %s.\n, myname);
 }

 Character::Character(char *myName, long myMaxHP, long myMaxMP)
 {
strcpy(name,myName);
maxHP = myMaxHP;
maxMP = myMaxMP;

currentHP = maxHP;
currentMP = maxMP;
 }

 Now I've tracked the SegFault down to the battle constructor,
 specifically the line where the 'Amy' Ally is being created.  The
 program enters the Ally constructor, and then SegFaults.  I have very
 little experience with gdb and ddd doesn't work at all.  Can anyone see
 the problem with this?  Am I out of stack space?  Do I need to start
 using the heap?





 To unsubscribe, send a blank message to mailto:[EMAIL PROTECTED].
 Yahoo! Groups Links







-- 

In the rhythm of music a secret is hidden;
If I were to divulge it, it would overturn the world.
   -- Jelaleddin Rumi


Re: [c-prog] Need help tracking down cause of SegFault [SOLVED]

2007-12-01 Thread Michael Sullivan

On Sat, 2007-12-01 at 18:02 -0500, Brett McCoy wrote:
 On Dec 1, 2007 5:27 PM, Michael Sullivan [EMAIL PROTECTED]
 wrote:
 
  I know that a segmentation fault is the equivalent of a null pointer
  exception in Java, but I don't understand why it's happening here.
 My
  full code is posted at
  http://www.espersunited.com/~michael/needhelp.txt . Basically the
  problem is this:
 
 A segmentation fault can mean you are accessing memory you have no
 permission to use, like if you are trying to access memory you have
 not allocated (null pointer).
 
 I didn't go through all of your code but a few things stuck out at me.
 
 One thing I recommend is to stop using char * or char[] and use the
 C++ string class, it'll eliminate some headaches with strings.
 
 Also, instead of using a plain old array in your battle class, I'd use
 a vector or or a list or similar kind of C++ container class, they are
 a lot more flexible than plain old arrays, especially when it comes to
 adding more entries into it.
 
 Definitely learn how to use a C++ debugger... if using gdb isn't up
 your alley, get Eclipse, KDevelop or Anjuta (I am assuming you are on
 Linux) and use their graphical debuggers (which probably use gdb
 underneath).
 
  class battle
  {
  private:
  Ally party[4];
  };
 
  battle::battle()
  {
  party[0] = Ally(Michael, 10, 7);
  party[1] = Ally(Amy, 8, 13);
  party[2] = Ally(Feli, 12, 15);
  party[3] = Ally(Imp, 9, 4);
  }
 
  class Ally : public Character
  {
  public:
  Ally(){}
  Ally(char*, long, long);
  ~Ally();
  };
 
  Ally::Ally(char* myname, long h, long m) : Character(myname, h, m)
  {
  printf(Arrived in Ally constructor for %s.\n, myname);
  }
 
  Character::Character(char *myName, long myMaxHP, long myMaxMP)
  {
  strcpy(name,myName);
  maxHP = myMaxHP;
  maxMP = myMaxMP;
 
  currentHP = maxHP;
  currentMP = maxMP;
  }
 
  Now I've tracked the SegFault down to the battle constructor,
  specifically the line where the 'Amy' Ally is being created. The
  program enters the Ally constructor, and then SegFaults. I have very
  little experience with gdb and ddd doesn't work at all. Can anyone
 see
  the problem with this? Am I out of stack space? Do I need to start
  using the heap?

I found a handy feature of gdb called 'backtrace' that told me where the
problem was.  It seems I was attempting to call SDL_FreeSurface on a
surface that I haven't gotten around to creating yet...
 



Re: [c-prog] Need help tracking down cause of SegFault

2007-12-01 Thread Thomas Hruska
Michael Sullivan wrote:
 I know that a segmentation fault is the equivalent of a null pointer
 exception in Java, but I don't understand why it's happening here.  My
 full code is posted at
 http://www.espersunited.com/~michael/needhelp.txt .  Basically the
 problem is this:
 
 class battle
 {
private:
   Ally party[4];
 };
 
 battle::battle()
 {
party[0] = Ally(Michael, 10, 7);
party[1] = Ally(Amy, 8, 13);
party[2] = Ally(Feli, 12, 15);
party[3] = Ally(Imp, 9, 4);
 }
 
 class Ally : public Character
 {
public:
   Ally(){}
   Ally(char*, long, long);
   ~Ally();

You still aren't using 'virtual' destructors.

 };
 
 Ally::Ally(char* myname, long h, long m) : Character(myname, h, m)
 {
 printf(Arrived in Ally constructor for %s.\n, myname);
 }
 
 Character::Character(char *myName, long myMaxHP, long myMaxMP)
 {
strcpy(name,myName);

Where/How is 'name' defined?  This is probably where your problem is.


maxHP = myMaxHP;
maxMP = myMaxMP;
 
currentHP = maxHP;
currentMP = maxMP;
 }
 
 Now I've tracked the SegFault down to the battle constructor,
 specifically the line where the 'Amy' Ally is being created.  The
 program enters the Ally constructor, and then SegFaults.  I have very
 little experience with gdb and ddd doesn't work at all.  Can anyone see
 the problem with this?  Am I out of stack space?  Do I need to start
 using the heap?

General observation:  You aren't using any pre-built C++ components. 
Brett already mentioned 'string', but I highly recommend BString.  If 
you are going to be tossing lots of string data around and aren't 
familiar with 'string', you might as well use the buff class I wrote 
(which offers a number of important features not found in 'string').

Also, you are statically declaring a party size to be 4.  If that will 
only allow 4 people and there will always be 4 people, then that's fine, 
but if you want it to be dynamic (4...6...3...more, less), then Block 
(or 'vector') is going to be more appropriate.

I recommend reading Safe C++ Design Principles.  I haven't had a seg. 
fault in almost 4 months at the library layer and over a year at the 
application layer.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/



Re: [c-prog] Need help tracking down cause of SegFault

2007-12-01 Thread ed
Michael Sullivan wrote:
 I know that a segmentation fault is the equivalent of a null pointer
 exception in Java, but I don't understand why it's happening here.  My
 full code is posted at
 http://www.espersunited.com/~michael/needhelp.txt .  Basically the
 problem is this:
 
 class battle
 {
private:
   Ally party[4];
 };
 
 battle::battle()
 {
party[0] = Ally(Michael, 10, 7);
party[1] = Ally(Amy, 8, 13);
party[2] = Ally(Feli, 12, 15);
party[3] = Ally(Imp, 9, 4);
 }
 
 class Ally : public Character
 {
public:
   Ally(){}
   Ally(char*, long, long);
   ~Ally();
 };
 
 Ally::Ally(char* myname, long h, long m) : Character(myname, h, m)
 {
 printf(Arrived in Ally constructor for %s.\n, myname);
 }
 
 Character::Character(char *myName, long myMaxHP, long myMaxMP)
 {
strcpy(name,myName);
maxHP = myMaxHP;
maxMP = myMaxMP;
 
currentHP = maxHP;
currentMP = maxMP;
 }
 
 Now I've tracked the SegFault down to the battle constructor,
 specifically the line where the 'Amy' Ally is being created.  The
 program enters the Ally constructor, and then SegFaults.  I have very
 little experience with gdb and ddd doesn't work at all.  Can anyone see
 the problem with this?  Am I out of stack space?  Do I need to start
 using the heap?
 
 
 
 

Maybe a gdb cheat sheet can be of help, they're available for most
popular utils,

We use a4 paper size here:
http://refcards.com/docs/peschr/gdb/gdb-refcard-a4.pdf

http://www.google.co.uk/search?hl=enq=gdb+refcardbtnG=Google+Searchmeta=





[Non-text portions of this message have been removed]



Re: [c-prog] need help

2007-11-23 Thread Thomas Hruska
Avik wrote:
 clear/flush your standard input buffer before you take a an input from 
 standard input device (i.e. keyboard).
 use fflush(stdin) before scanf. e.g.
 
 
 scanf(%d, y);
 fflush(stdin);
 
 scanf(%c, z);

fflush(stdin) is NON-ANSI Standard behavior.  Besides...the input data 
could already be in the queue.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/



Re: [c-prog] need help

2007-11-23 Thread Avik
clear/flush your standard input buffer before you take a an input from standard 
input device (i.e. keyboard).
use fflush(stdin) before scanf. e.g.


scanf(%d, y);
fflush(stdin);

scanf(%c, z);

- Original Message 
From: naveen babu [EMAIL PROTECTED]
To: c-prog@yahoogroups.com
Sent: Thursday, 22 November, 2007 1:16:58 PM
Subject: [c-prog] need help









  



in LINUX i have return C program as



int x; 

int y;

char z;



scanf(%d, x);

scanf(%d, y);

scanf(%c, z);



problem is , it is not taking the last scanf  .i.e.  char value z

control is not waiting for input it is coming out of the program exeecution

please help me out in this



Get the freedom to save as many mails as you wish. To know how, go to 
http://help. yahoo.com/ l/in/yahoo/ mail/yahoomail/ tools/tools- 08.html



[Non-text portions of this message have been removed]






  







!--

#ygrp-mkp{
border:1px solid #d8d8d8;font-family:Arial;margin:14px 0px;padding:0px 14px;}
#ygrp-mkp hr{
border:1px solid #d8d8d8;}
#ygrp-mkp #hd{
color:#628c2a;font-size:85%;font-weight:bold;line-height:122%;margin:10px 0px;}
#ygrp-mkp #ads{
margin-bottom:10px;}
#ygrp-mkp .ad{
padding:0 0;}
#ygrp-mkp .ad a{
color:#ff;text-decoration:none;}
--



!--

#ygrp-sponsor #ygrp-lc{
font-family:Arial;}
#ygrp-sponsor #ygrp-lc #hd{
margin:10px 0px;font-weight:bold;font-size:78%;line-height:122%;}
#ygrp-sponsor #ygrp-lc .ad{
margin-bottom:10px;padding:0 0;}
--



!--

#ygrp-mlmsg {font-size:13px;font-family:arial, helvetica, clean, sans-serif;}
#ygrp-mlmsg table {font-size:inherit;font:100%;}
#ygrp-mlmsg select, input, textarea {font:99% arial, helvetica, clean, 
sans-serif;}
#ygrp-mlmsg pre, code {font:115% monospace;}
#ygrp-mlmsg * {line-height:1.22em;}
#ygrp-text{
font-family:Georgia;
}
#ygrp-text p{
margin:0 0 1em 0;}
#ygrp-tpmsgs{
font-family:Arial;
clear:both;}
#ygrp-vitnav{
padding-top:10px;font-family:Verdana;font-size:77%;margin:0;}
#ygrp-vitnav a{
padding:0 1px;}
#ygrp-actbar{
clear:both;margin:25px 0;white-space:nowrap;color:#666;text-align:right;}
#ygrp-actbar .left{
float:left;white-space:nowrap;}
.bld{font-weight:bold;}
#ygrp-grft{
font-family:Verdana;font-size:77%;padding:15px 0;}
#ygrp-ft{
font-family:verdana;font-size:77%;border-top:1px solid #666;
padding:5px 0;
}
#ygrp-mlmsg #logo{
padding-bottom:10px;}

#ygrp-vital{
background-color:#e0ecee;margin-bottom:20px;padding:2px 0 8px 8px;}
#ygrp-vital #vithd{
font-size:77%;font-family:Verdana;font-weight:bold;color:#333;text-transform:uppercase;}
#ygrp-vital ul{
padding:0;margin:2px 0;}
#ygrp-vital ul li{
list-style-type:none;clear:both;border:1px solid #e0ecee;
}
#ygrp-vital ul li .ct{
font-weight:bold;color:#ff7900;float:right;width:2em;text-align:right;padding-right:.5em;}
#ygrp-vital ul li .cat{
font-weight:bold;}
#ygrp-vital a{
text-decoration:none;}

#ygrp-vital a:hover{
text-decoration:underline;}

#ygrp-sponsor #hd{
color:#999;font-size:77%;}
#ygrp-sponsor #ov{
padding:6px 13px;background-color:#e0ecee;margin-bottom:20px;}
#ygrp-sponsor #ov ul{
padding:0 0 0 8px;margin:0;}
#ygrp-sponsor #ov li{
list-style-type:square;padding:6px 0;font-size:77%;}
#ygrp-sponsor #ov li a{
text-decoration:none;font-size:130%;}
#ygrp-sponsor #nc{
background-color:#eee;margin-bottom:20px;padding:0 8px;}
#ygrp-sponsor .ad{
padding:8px 0;}
#ygrp-sponsor .ad #hd1{
font-family:Arial;font-weight:bold;color:#628c2a;font-size:100%;line-height:122%;}
#ygrp-sponsor .ad a{
text-decoration:none;}
#ygrp-sponsor .ad a:hover{
text-decoration:underline;}
#ygrp-sponsor .ad p{
margin:0;}
o{font-size:0;}
.MsoNormal{
margin:0 0 0 0;}
#ygrp-text tt{
font-size:120%;}
blockquote{margin:0 0 0 4px;}
.replbq{margin:4;}
--








  Save all your chat conversations. Find them online at 
http://in.messenger.yahoo.com/webmessengerpromo.php

[Non-text portions of this message have been removed]



Re: [c-prog] need help

2007-11-22 Thread Prashant Gairola
Hi Naveen,

 just provide a space before %c and it will work.

int x;
int y;
char z;

scanf(%d,x);
scanf(%d,y);
scanf( %c,z);

Regards,
Prashant

On Nov 22, 2007 1:16 PM, naveen babu [EMAIL PROTECTED] wrote:






 in LINUX i have return C program as

  int x;
  int y;
  char z;

  scanf(%d,x);
  scanf(%d,y);
  scanf(%c,z);

  problem is , it is not taking the last scanf .i.e. char value z
  control is not waiting for input it is coming out of the program exeecution
  please help me out in this

  Get the freedom to save as many mails as you wish. To know how, go to
 http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html

  [Non-text portions of this message have been removed]

  


Re: [c-prog] need help with c-programming...just can put things together

2007-04-05 Thread Sumit Chawla
On 4/5/07, Sumit Chawla [EMAIL PROTECTED] wrote:



 On 05 Apr 2007 02:11:15 -0700, Meadowcreek_99 [EMAIL PROTECTED]
 wrote:
 
Write a function that takes as input a string containing HTML source
  code and returns both the # of images referenced in the code and the
  total screen area (in square pixels) occupied by the images
  The function MUST have the following declarationint
  estImageContent(char *pacHTML, long int *pliArea);
 
  1. Prompt the user for an input filename
  2. Open the file, read its contents into a string (up to 2 bytes),
  close file
  3. Call estImageContent()
  4. Print the following to the screen:
  1. Input filename
  2. Estimated # of images
  3. Estimated total screen area in square pixels
  5. Loop back to prompt
 
  this is what i have so far
  /* the first thing i did was uppercase*/
 
  #include stdio.h
  #include string.h
  #include ctype.h
 
  void fileToString(char filename[], char theString[]);
  char *upperCaseTheString(char *pc);
 
  int main()
  {
  char filename[] = p6in1.txt;
  char theString[2] = ;
 
  fileToString(filename, theString);
  upperCaseTheString(theString);
 
  printf(%s, theString);
 
  return (0);
  }
 
  void fileToString(char filename[], char theString[]) {
  FILE *fp;
  char buf[BUFSIZ+1];
 
  fp = fopen(filename, r);
 
  while (fgets(buf, BUFSIZ, fp) != NULL) {
  strcat(theString, buf);
  }
 
  fclose(fp);
 
  }
 
  char *upperCaseTheString(char *pc) {
  char *pcReturn = pc;
 
  while (*pc != '\0') {
  *pc = toupper(*pc);
  pc++;
  }
 
  return pcReturn;
  }
  fp=fopen(p6in.txt,r);
 
  if(fp==NULL)
  {
  printf(\n\t\tSORRY..\n\t\... CANNOT OPEN FILE\n);
  return 0;
  }
 
  printf(\n\t\tFILE data.txt FOUND!\n);
  printf(\n\nSearch what string?\t);
  gets(str1);
 
  while ((fgets( str2, 100, fp )) != NULL) //not the end of file
  {
  if (strcmp(str1, str2)
  iCount++;
 
  }
  printf(\n%d OCCURRENCES OF STRING %s FOUND, iCount ,str1);
 
  }
 
   __._,_.
 























 
 


 How are u planning to find the area of images. Are u expecting it to be
 specified in IMG tags?
 -

 i mean the width and height of the of the image is specified in the html
IMG tag itself
-- 
Regards
Sumit Chawla (eNetra : Hail the Invention)


Computers are useless. They can only give you answers.:Pablo Picasso


[Non-text portions of this message have been removed]



Re: [c-prog] need help

2006-12-09 Thread Paul Herring
On 12/9/06, Pedro Izecksohn [EMAIL PROTECTED] wrote:
 --- ed [EMAIL PROTECTED] wrote:

  in soviet russia homework writes you!!

  The guy is in Egypt.

It's a Slashdot joke/meme.

-- 
PJH

#713059 +(1255)- [X]

SaintAlvus Does the name Doctor Pavlov ring a bell?


Re: [c-prog] need help

2006-12-08 Thread ed
On Fri, 08 Dec 2006 08:47:30 -
madmsb [EMAIL PROTECTED] wrote:

 hi all 
 i,m new in C++ i want to know how to make this code 
 my project is about bank timing simulation ( castmer going to bank one
 
 by one we want to calculate the time arrive and the time that castmer 
 will be stay in the bank and the total timming )  
 plz any one have this code send it to me  
 i have code that makeing account managment but i can't make this on 
 any help will be useful 
 thankx

in soviet russia homework writes you!!

-- 
Regards, Ed  :: http://www.usenix.org.uk
just another linux hacker
No woman has ever lived long enough to cuddle with Chuck Norris after 
sex. Instead, he cuddles with his beard. 


Re: [c-prog] need help

2006-12-08 Thread Pedro Izecksohn
--- ed [EMAIL PROTECTED] wrote:

 in soviet russia homework writes you!!

  The guy is in Egypt.



 

Yahoo! Music Unlimited
Access over 1 million songs.
http://music.yahoo.com/unlimited