Jump to content

I/O processing

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
renoald

renoald

    Newbie

  • Members
  • Pip
  • 8 posts
I/O processing
This is the file in .txt format:
#Distance
D 1-2 9997.930 0.038
D 2-3 9998.030 0.038
D 3-1 14142.110 0.094
#Angle
A 1-2-3 44-59-19 2.4
A 2-3-1 90-1-22.1 2.4
A 3-1-2 44-59-18.1 2
#Aizthmuth
B 3-1 225-0-15 1
B 1-2 0-0-58 1
#Koordinat Stesen
C 1 10000.00 10000.00 ! !
C 2 10002.7140 19998.00
C 3 20000.7140 19999.26

**********
I want to develop a visual basic program to reading file above.
This is condition i want:
-when vb read '#' character , just skip the line.(line or word begin with '#' is comment)
-when vb read 'D' , split the '1-2' to station value(String), 9997.930 and 0.038 to double(9997.93 to distance value and 0 0.038 to error value for distance)
-above step are same when vb read 'A','B' and 'c'(44-59-19(44 degree 59 minute 19 second),1-2-3 (this is station will convert to string)
-for C, if the line C end with ! ! , i want difference it with another value of c.(!! mean fixed coordinate)

i have try to build this code before , but the code i build are very complex!
I want your opinion how to develop this code.
Thank You for who can help me

Attached Files

  • Attached File  FILE.TXT   294bytes   61 downloads


#2
mbshinde78

mbshinde78

    Newbie

  • Members
  • PipPip
  • 19 posts
1. Use line input function to read the file line by line into a string

2. Use left function to check the first character from the string whether it is # or A or B etc.

3. Use split function to split the remaining string after D or whatever into an array using space as delimeter.

4. To check whether C ends with ! use right function.

I hope this solves your issue. I cannot give you pseudo code at the moment.

#3
Guest_Jordan_*

Guest_Jordan_*
  • Guests
Can you post the code you have please?

#4
MeTh0Dz

MeTh0Dz

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,119 posts
Just write a line parser.

#5
renoald

renoald

    Newbie

  • Members
  • Pip
  • 8 posts
i think my code i write before are same concept with what suggest by mbshinde78 , but the problem is the '#' sometime not start at first line , like C 1-2 10000 10000 !! #this is fixed coordinate , how to solve it ?

again l lost the code i write before because my computer have critical problem , i don't save a copy. But i will post my code again when i have finish the code. Thank for your concern.