Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Just a simple newbie question!

rudlophrudloph Posts: 1Member
Hello!

I am interested in writing a program that opens a textfile and fetches key values (coordinate numbers) from this textfile.

I then want to add simple predefined text & new coordinate values into this textfile, based upon the first key value.

Where should I start???, I am a total newbie!
I got the idea in my head clear, but getting it into the computer is not the same thing.

Recommend any programming language?

example of what i mean:

1.The txt file contains a coordinate in numbers but lets call this value "x".

2. I would like to use "x" as a reference point for inserting new values, lets say a value like that could be (+2.5, 3.2)

3. At the end "x" is replaced by the new value(x+2.5, 3.2)

It sounds simple to do manually and why need a program for it, but there is alot of values to be inserted, and different "x"s.

As I said Im totally green on this so any help at all, and I would be very thankful!

Comments

  • ShadovvShadovv Posts: 31Member
    Try here:
    http://www.cplusplus.com/ref/cstring/strtok.html

    Simpliest way I can think of doing this is to:
    - tokenize all different "x"s (assuming they are all different)
    - insert your string (eg. +2.5, 3.2) after the x.
    - write/append the output to a different file.
    - repeat until all x's are found and end of file is reach.

    hope that helps.

    : Hello!
    :
    : I am interested in writing a program that opens a textfile and fetches key values (coordinate numbers) from this textfile.
    :
    : I then want to add simple predefined text & new coordinate values into this textfile, based upon the first key value.
    :
    : Where should I start???, I am a total newbie!
    : I got the idea in my head clear, but getting it into the computer is not the same thing.
    :
    : Recommend any programming language?
    :
    : example of what i mean:
    :
    : 1.The txt file contains a coordinate in numbers but lets call this value "x".
    :
    : 2. I would like to use "x" as a reference point for inserting new values, lets say a value like that could be (+2.5, 3.2)
    :
    : 3. At the end "x" is replaced by the new value(x+2.5, 3.2)
    :
    : It sounds simple to do manually and why need a program for it, but there is alot of values to be inserted, and different "x"s.
    :
    : As I said Im totally green on this so any help at all, and I would be very thankful!
    :

  • Onyx BlacksmitOnyx Blacksmit Posts: 15Member
    : Hello!
    :
    : I am interested in writing a program that opens a textfile and fetches key values (coordinate numbers) from this textfile.
    :
    : I then want to add simple predefined text & new coordinate values into this textfile, based upon the first key value.
    :
    : Where should I start???, I am a total newbie!
    : I got the idea in my head clear, but getting it into the computer is not the same thing.
    :
    : Recommend any programming language?
    :
    : example of what i mean:
    :
    : 1.The txt file contains a coordinate in numbers but lets call this value "x".
    :
    : 2. I would like to use "x" as a reference point for inserting new values, lets say a value like that could be (+2.5, 3.2)
    :
    : 3. At the end "x" is replaced by the new value(x+2.5, 3.2)
    :
    : It sounds simple to do manually and why need a program for it, but there is alot of values to be inserted, and different "x"s.
    :
    : As I said Im totally green on this so any help at all, and I would be very thankful!
    :
    actuall, i had to write a very simular app. I wrote it in vb4(the current vb at the time) I had to insert about 5,000 commas between auto-generated pieces of data for a 'c' array. simpler than what you need to do, but a very simple program in a lang like Visual Basic.
    I wouldn't waist my time with any lower level lang than vb for an appearant side app like this.

    I don't have the prog ne more,(on my fried harddrive!) but all i did was step through the text file, one char at a time, while storing the last 3 chars to a string, and testing the string for my condition to add the comma.(a space between two numbers.) as i added one char to the string, i bumped the oldest char to a new text file,and moved the two remaining char over 1. this gave me a rolling 3 char sample of the text that i could test, and modify as needed...

    hope this gives some help. i don't know what you have available(as in tools, like vs,vc,vb, or any other V). this is just how i(and several others) aproached this type of problem.
  • DrMartenDrMarten Posts: 748Member
    [b][red]This message was edited by DrMarten at 2005-4-7 18:14:36[/red][/b][hr]
    You could try downloading LIBERTY BASIC from:->

    http://www.libertybasic.com/download.html

    which has a free trial version.

    With that program you cand read and write values to and from files.

    See the FILE HANDLING sectionin the inbuilt HELP.

    If you want an example bit of code for that program just ask and I will post it here another time.

    Try it and see what you think.



Sign In or Register to comment.