Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: read coordinates from text files.

  1. #11
    Join Date
    Jul 2005
    Posts
    93
    Rep Power
    0

    Default

    am using vb6 here is my codes

    Open App.Path & "\streetx.txt" For Input As #1 ' Open file
    Line Input #1, x

    Open App.Path & "\streetxx.txt" For Input As #2 ' Open file
    Line Input #2, y

    Open App.Path & "\streetx.txt" For Input As #3 ' Open file
    Line Input #3, x1

    Open App.Path & "\streety.txt" For Input As #4 ' Open file
    Line Input #4, y1


    For count = 1 To 1242



    Line Input #1, x
    Line Input #2, y
    Line Input #3, x1
    Line Input #4, y1
    Picture1.Line (x, y)-(x1, y1), CommonDialog1.Color

    Close #1
    Close #2
    Close #3
    Close #4
    Next

    with this i plit the x and y values.
    so the x values in one files and y in the other files as you can see.

    so i open the x files two times with two different names, and i will use the firet line in the that files for x1, and second line for x2. and i did the same for the y values but am having problems with the looping. there are 1242 line in each of the two files. please help me my loop just kept crashing.

  2. #12
    Join Date
    Oct 2005
    Posts
    745
    Rep Power
    0

    Default

    Quote Originally Posted by hassanvoyeau View Post
    I not going to spoon feed he. I prefer to show him what wrong with what he doing. Better to teach a man to fish than to give him a fish.
    Sometime to save you sanity might as well give he a fish. Some people just can't fish, if you get what I'm saying. Not talking bout you DJ Still, just some fishermen I've had to work with at times
    3.14159265358979323846264338327950288
    4197169399375105820974944592307816406
    28620899862803482534211706798 pi 101

  3. #13
    Join Date
    Jan 2007
    Posts
    164
    Rep Power
    18

    Default

    Quote Originally Posted by Dj Still
    1242 line in each of the two files. please help me my loop just kept crashing.
    Your loop should be 1 to 1241 (since you already read the first line before the start of the loop)

  4. #14
    Join Date
    May 2006
    Posts
    196
    Rep Power
    0

    Default

    Quote Originally Posted by hassanvoyeau View Post
    Your loop should be 1 to 1241 (since you already read the first line before the start of the loop)
    Wouldn't he be safer ending the loop on End Of File (EOF), so that the code can take a file with varying amounts of coordinates.
    I went to a bookstore and asked the saleswoman, "Where's the self-help section?" She said if she told me, it would defeat the purpose.
    Windows 7 Pro, Gigabyte MA785GM-US2H, AMD Athlon II 245, OCZ Reaper 2X2GB DDR2 1066, WD 500GB+WD 200GB, Cosair 400W, 23" eMachine 1080p Monitor

  5. #15
    Join Date
    Oct 2005
    Posts
    745
    Rep Power
    0

    Default

    You mention two files but yet I see three filenames
    streetx.txt
    streetxx.txt
    streety.txt
    3.14159265358979323846264338327950288
    4197169399375105820974944592307816406
    28620899862803482534211706798 pi 101

  6. #16
    Join Date
    Dec 2004
    Posts
    159
    Rep Power
    0

    Default

    DJ Still, I notice that these two file reader are link to the same file name that could be a problem.

    Quote Originally Posted by Dj Still View Post
    Open App.Path & "\streetx.txt" For Input As #1 ' Open file
    Line Input #1, x
    Quote Originally Posted by Dj Still View Post
    Open App.Path & "\streetx.txt" For Input As #3 ' Open file
    Line Input #3, x1
    and the next thing you can do is trace your application to see where there error is occurring. Also you need to put in error handler and EOF.
    live good today cause u will never know wat will happen 2marrow and it was never promised to no man either

  7. #17
    Join Date
    Oct 2005
    Posts
    745
    Rep Power
    0

    Default

    Why not store all the co-ordinates in a single file? Is it a requirement that they be in separate files?
    x,y
    x1,y1
    x2,y2
    and so on.........
    3.14159265358979323846264338327950288
    4197169399375105820974944592307816406
    28620899862803482534211706798 pi 101

  8. #18
    Join Date
    Dec 2002
    Posts
    500
    Rep Power
    0

    Default

    why, after structured pseudocode this bredda yah haffi mess up di thread wid VB6 code?

    anyway a ur thread still, do u thing.

    i still dont see the reason u want seperate the coordinated into different files, they dont make the problem easier to solve, they dont lower the complexity, it doesnt make coding it any easier, and it doesnt get rid of the problem u had before?

    (mi nuh really code VB6, dats why mi a chat suh... ignore mi)

    but fi who actually do VB6 code, does this line really make sense or he just slap in the pseudocode into he VB6 code :
    Code:
    Picture1.Line (x, y)-(x1, y1), CommonDialog1.Color
    Last edited by icymint3; Apr 23, 2007 at 04:54 PM.
    Cultured in Aggression and Koding like a Warrior!!
    “Common sense is instinct. Enough of it is genius.” - George Bernard Shaw.
    "The significant problems we face cannot be solved by the same level of thinking that created them." - Albert Einstein

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •