Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Xingo

Converting stings into arrays

This topic is 6192 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Well snice i was more into python, i made a little hack i guess converting strings into intergers, but it was easy becuase python is not huge and all of its docs are easy to read. Here is something that I used in my game i made in python, it is supose to read map data i made in a file, only problem is I have no idea how to do this is c++ (this codes works too): import os import sys mapdat= [] open_file = open(''Map.dat'', ''r'') read_file = read(open_file) x = 0 lines = len(open(read_file).readlines()) #Forgot why i put this #here supose to read the number of line in Map.dat used for while while x < lines: # Comment: Should have use a for statement. read = open_file.readline() ev = eval(read) #Converts string into mapdat.append(ev) x += 1 print lines Anyways I am having problems with ev = eval(read), becuase i dont know how to convert strings into not numbers but arrays (took me about 3 mins finally to figure out that name LOL). Yeah soo can anyone help?

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!