[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Linux: shared memory odd problem

Posted on 2009-05-08
6
Medium Priority
?
751 Views
Last Modified: 2012-06-27
Hello
I hate ask long and odd questions but this problem make me really insane!!!!!!! please help me. I apologize you.

I coded a game in Linux and it works. (fireballs.cpp)
I decided to code it using shared memory and fork. (fork.cpp)
it works but Player class's Move function that should move player's shield, doesn't clear previously printed characters.

I hope help me

want to mention compilation command:
g++ fork.cpp -o fork.o -lpthread -lncurses -O2 (also for fireballs.cpp)

I apologize you again for my long and odd question. please help me
thank you very much
yours sincerely
fireballs.txt
fork.txt
0
Comment
Question by:CSecurity
  • 3
  • 2
6 Comments
 
LVL 8

Accepted Solution

by:
eager earned 1600 total points
ID: 24343939
Run your program under a debugger (gdb, for example) and step through the code which you expect to clear the characters.

It's a bit tricky to debug a program which forks, because the debugger will only follow the parent, not the child process.  One way around this is to print the PID for the child and have it sleep for a while, which will allow you enough time to attach to the child process.  
0
 
LVL 53

Assisted Solution

by:Infinity08
Infinity08 earned 400 total points
ID: 24352225
Maybe you should simply clear the screen before drawing in the main loop ?
0
 
LVL 53

Expert Comment

by:Infinity08
ID: 24480925
>> it's clear why!

No it's not :)

Do you still have a problem with this ? Did you try our suggestions ?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 17

Author Closing Comment

by:CSecurity
ID: 31579655
although you did not help me but giving you some point will happy me!
thank you very much for your comment
infinity, my friend, sorry!
0
 
LVL 53

Expert Comment

by:Infinity08
ID: 24481055
>> although you did not help me

If you want, we can help you further. There's no need to close the question if you don't have a solution. If you explain to us what the problem currently is, we'll be happy to assist you with that :)
0
 
LVL 17

Author Comment

by:CSecurity
ID: 24481348
my friend
my problem was so odd and hard to tell it to someone else, unfortunately!
so, now I don't want to fix the problem because I don't need the code anymore!
so, I apologize you anymore
regards
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Often times it's very very easy to extend a volume on a Linux instance in AWS, but impossible to shrink it. I wanted to contribute to the experts-exchange community a way of providing a procedure that works on an AWS instance. It can also be used on…
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question