Click here to Skip to main content
15,914,386 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Edit Control multiline - number of lines Pin
toxcct25-Aug-06 2:51
toxcct25-Aug-06 2:51 
Questionattaching icons to the menu options Pin
radhika2824-Aug-06 20:50
radhika2824-Aug-06 20:50 
AnswerRe: attaching icons to the menu options Pin
KarstenK24-Aug-06 22:56
mveKarstenK24-Aug-06 22:56 
AnswerRe: attaching icons to the menu options Pin
Hamid_RT25-Aug-06 1:38
Hamid_RT25-Aug-06 1:38 
GeneralRe: attaching icons to the menu options Pin
radhika2825-Aug-06 3:39
radhika2825-Aug-06 3:39 
GeneralRe: attaching icons to the menu options Pin
Hamid_RT25-Aug-06 4:34
Hamid_RT25-Aug-06 4:34 
GeneralRe: attaching icons to the menu options Pin
radhika2825-Aug-06 18:58
radhika2825-Aug-06 18:58 
Questionreading from text file and storing in 2D array Pin
Brycestro24-Aug-06 20:16
Brycestro24-Aug-06 20:16 
Hi there, i'm relatively new to this forum in the sense that i've only ever posted here once or twice quite some time ago. Anyway, i've come across a slight problem in a very basic Win32 console application i'm working on. Some might be familiar with the "Game of Life" in which there are a number of characters placed on a two dimensional board in various squares. You then iterate through generations and the number of characters in the surrounding 8 squares of each character determines whether the creature dies from overcrowding, dies from isolation or lives through having the right amount of neighbours. Ok, so that's just the background.

I'm up to the part of the game that allows the user to load a 'board' or 'game' from a text file. The textfile formatting that has to be used is very simple. The first line of the text file contains an integer from 1 to 40 which is read and specifies how big the board is (so if it was 5 it would be a 5 x 5 board).

The preceding lines are made up of both spaces and 'X's which represent either no creature in a space or a creature in a space respectively. So as an example, the following text file would represent a 5 x 5 board with 3 creatures in the middle of it (pretending that the underscores represent spaces whereas in the textfile they actually are spaces):

5
_____
_____
_XXX_
_____
_____
<end of="" file="" here="">.

So for that example, i'm trying to manipulate the text file to store a space in the 2D array for all values except for myArray[3][2], myArray[3][3] and myArray[3][4] which i want to have an 'X' stored in.

I'm not having any problems connecting to the textfile, just trying to get my head around manipulating it once it's open. I figure a nested iterative loop for the myArray[i] and myArray[j] values but can't get my head around how to read a single character each time and then discard the new line character at the end of each line so it doesn't get read plus discarding the end of file character if that is even necessary.

Any help is much appreciated, i've been working on getting this part to work for quite some time with no success. Cheers, Bryce.
AnswerRe: reading from text file and storing in 2D array Pin
_AnsHUMAN_ 24-Aug-06 20:36
_AnsHUMAN_ 24-Aug-06 20:36 
GeneralRe: reading from text file and storing in 2D array Pin
Brycestro24-Aug-06 21:18
Brycestro24-Aug-06 21:18 
QuestionApplication not running. Unavailability of DLLs ?? Pin
siddhen24-Aug-06 19:30
siddhen24-Aug-06 19:30 
AnswerRe: Application not running. Unavailability of DLLs ?? Pin
prasad_som24-Aug-06 19:35
prasad_som24-Aug-06 19:35 
Questioncpu idle time Pin
_tasleem24-Aug-06 19:08
_tasleem24-Aug-06 19:08 
AnswerRe: cpu idle time Pin
prasad_som24-Aug-06 20:32
prasad_som24-Aug-06 20:32 
AnswerRe: cpu idle time Pin
Hamid_RT24-Aug-06 22:52
Hamid_RT24-Aug-06 22:52 
GeneralRe: cpu idle time Pin
_tasleem25-Aug-06 3:07
_tasleem25-Aug-06 3:07 
GeneralRe: cpu idle time Pin
Hamid_RT25-Aug-06 4:36
Hamid_RT25-Aug-06 4:36 
Questionthe problem in Client &amp;Server [modified] Pin
ramanand_bulusu24-Aug-06 18:53
ramanand_bulusu24-Aug-06 18:53 
AnswerRe: the problem in Client &amp;Server Pin
uday kiran janaswamy24-Aug-06 19:00
uday kiran janaswamy24-Aug-06 19:00 
GeneralRe: the problem in Client &amp;Server Pin
ramanand_bulusu24-Aug-06 19:40
ramanand_bulusu24-Aug-06 19:40 
AnswerRe: the problem in Client &amp;Server Pin
uday kiran janaswamy24-Aug-06 19:08
uday kiran janaswamy24-Aug-06 19:08 
GeneralRe: the problem in Client &amp;Server Pin
ramanand_bulusu24-Aug-06 19:50
ramanand_bulusu24-Aug-06 19:50 
Questionprinter data rendering Pin
hiteshpradip24-Aug-06 18:50
hiteshpradip24-Aug-06 18:50 
AnswerRe: printer data rendering Pin
Hamid_RT3-Sep-06 9:12
Hamid_RT3-Sep-06 9:12 
QuestionHow to destroy and delete a modeless Dialog Pin
NorGUI24-Aug-06 16:09
NorGUI24-Aug-06 16:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.