[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Linux: shared memory odd problem

Posted on 2009-05-08
6
Medium Priority
?
750 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: 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

Independent Software Vendors: 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!

Question has a verified solution.

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

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…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses
Course of the Month13 days, 19 hours left to enroll

656 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