Thread: where to start

  1. #1
    Registered User
    Join Date
    Jan 2006
    Posts
    4

    where to start

    now if i clear this first... please dont post any code in this thread, i want to learn the code without being told.

    a project i have just started, will have a open button, so the user can select an npj file. the npj file contains xml data like so

    Code:
    <WAYPOINT_LIST>
    		<ID>8</ID>
    		<NAME>WPList</NAME>
    		<FOLDER>WPList Folder</FOLDER>
    		<MEMBERS></MEMBERS>
    		<COLOR>00000000</COLOR>
    	</WAYPOINT_LIST>
    	<WAYPOINT_LIST>
    		<ID>9</ID>
    		<NAME>WPList</NAME>
    		<FOLDER>WPList Folder</FOLDER>
    		<MEMBERS></MEMBERS>
    		<COLOR>00000000</COLOR>
    	</WAYPOINT_LIST>
    	<AI>
    		<ID>1710</ID>
    		<NAME>[Cindo03] -- Indonesian Civilian #3 Male</NAME>
    		<TYPE_ID>2067</TYPE_ID>
    		<UNSEL_COLOR>FF00</UNSEL_COLOR>
    		<DESCRIPTION>[Cindo03] -- Indonesian Civilian #3 Male</DESCRIPTION>
    		<POSITION>
    			<X>-755.461548</X>
    			<Z>-1422.528076</Z>
    		</POSITION>
    		<TEAM>2</TEAM>
    		<ACCURACY1>75</ACCURACY1>
    		<ACCURACY2>100</ACCURACY2>
    		<FIRE_TIMER>5</FIRE_TIMER>
    		<VISION_RANGE>100</VISION_RANGE>
    		<MIN_ATTACK>0</MIN_ATTACK>
    		<MAX_ATTACK>100</MAX_ATTACK>
    		<ALERT_STATE>2</ALERT_STATE>
    	</AI>
    	<AI>
    		<ID>1711</ID>
    		<NAME>[Cindo03] -- Indonesian Civilian #3 Male (1)</NAME>
    		<TYPE_ID>2067</TYPE_ID>
    		<UNSEL_COLOR>FF00</UNSEL_COLOR>
    		<DESCRIPTION>[Cindo03] -- Indonesian Civilian #3 Male (1)</DESCRIPTION>
    		<POSITION>
    			<X>-760.761108</X>
    			<Z>-1422.518066</Z>
    		</POSITION>
    		<TEAM>2</TEAM>
    		<ACCURACY1>75</ACCURACY1>
    		<ACCURACY2>100</ACCURACY2>
    		<FIRE_TIMER>5</FIRE_TIMER>
    		<VISION_RANGE>100</VISION_RANGE>
    		<MIN_ATTACK>0</MIN_ATTACK>
    		<MAX_ATTACK>100</MAX_ATTACK>
    		<ALERT_STATE>2</ALERT_STATE>
    	</AI>
    now when the user clicks to open the file, i would like a combo box to display the "description" of all of the AI's in the npj file
    eg

    Code:
    [Cindo03] -- Indonesian Civilian #3 Male (1)
    if the user selects the above AI in the list, and then clicks a generate script button, it would output that particular AI's ID. in this case "1711"


    now please dont tell me how to do this, but please could you tell me what i need to go away and revise.. databases? .. to be honest im lost with the whole "open a file and display its contents"

    i know how to create a file by a user clicking a button... if you would need to know what level im at with this to help me, here is a basic program i made

    http://www.freewebs.com/theworldofbr...athermanV2.zip
    Last edited by brad.g; 01-12-2006 at 02:03 AM.

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Do you know how to open a file? If not, google for "ifstream". If yes, sorry, my under-estimation.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  3. #3
    Registered User
    Join Date
    Jan 2006
    Posts
    4
    no i dont know how to open a file... but thats the kid of answer im after , thankyou

    would rather experianced people say " go learn about ...." rather than tellin me how to do it

  4. #4
    Registered User
    Join Date
    Jan 2006
    Posts
    21
    Btw. how can you import a picture in visual c++ express edition??
    it's kinda weird

  5. #5
    semi-colon generator ChaosEngine's Avatar
    Join Date
    Sep 2005
    Location
    Chch, NZ
    Posts
    597
    I think you want an xml parser. Have a look at tinyxml.
    or if you're using the .net framework, look at their xml classes, and lookup XPATH queries
    "I saw a sign that said 'Drink Canada Dry', so I started"
    -- Brendan Behan

    Free Compiler: Visual C++ 2005 Express
    If you program in C++, you need Boost. You should also know how to use the Standard Library (STL). Want to make games? After reading this, I don't like WxWidgets anymore. Want to add some scripting to your App?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Data Structure Eror
    By prominababy in forum C Programming
    Replies: 3
    Last Post: 01-06-2009, 09:35 AM
  2. Adventures in labyrinth generation.
    By guesst in forum Game Programming
    Replies: 8
    Last Post: 10-12-2008, 01:30 PM
  3. C++ gui for windows where to start
    By prixone in forum Windows Programming
    Replies: 2
    Last Post: 12-16-2006, 11:48 PM
  4. GNOME Desktop won't start (Mandriva)
    By psychopath in forum Tech Board
    Replies: 10
    Last Post: 07-19-2006, 01:21 PM
  5. Start bar color in WinXP
    By confuted in forum Tech Board
    Replies: 4
    Last Post: 05-03-2003, 06:18 AM