Solved

Linux: shared memory odd problem

Posted on 2009-05-08
6
741 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 400 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 100 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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
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

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now