Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Using File

Posted on 2000-04-18
1
Medium Priority
?
129 Views
Last Modified: 2012-05-04
I can't write on file.
I want to save my masiv(i,1),masiv(i,2) and masiv(i,3) on file. But I can't
See the source
Thanks


Dim broj As Byte
Dim n As Integer                ' broj redowe w flohdnia file
Dim FileNameIn As String
Dim FileNameOut As String
Dim mas(100, 3) As Double
Dim masiv(100, 3) As Double
FileNameIn = "c:\Testfile1.txt"        ' imeto na whodnia file
FileNameOut = "c:\Testfile11.txt"       ' imeto na izhodnia file

    Open FileNameIn For Input As #1
  n = 0
  While (Not (EOF(1)))
      Line Input #1, x
      n = n + 1
  Wend
    Close #1
   
          Open FileNameIn For Input As #1
  For i = 1 To n
      For j = 1 To 3
          Input #1, mas(i, j)
      Next j
  Next i
Close #1

L1 = 0
For i = 1 To n
L = mas(i, 3)
L3 = mas(1, 3)
L2 = L1 + L
k = (L3 / 2) + (L / 2) + (L2 - L)
A1x = k - (L / 2)
A1y = k + D / 2
L1 = L1 + L
masiv(i, 1) = i
masiv(i, 2) = A1x
masiv(i, 3) = A1y
MsgBox masiv(i, 3)
Next i

  For i = i To n
Open FileNameOut For Output As #1
Print #1, masiv(i, 1), masiv(i, 2), masiv(i, 3)
Close #1
    Next i

0
Comment
Question by:Nick1_bg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 32

Accepted Solution

by:
Brendt Hess earned 200 total points
ID: 2728640
You're problem is the save code.  You are re-opening and closing the output file at each iteration.  Each time you open it like this, you erase the previous version of the file.

Rewrite your code:


Open FileNameOut For Output As #1
For i = i To n
  Print #1, masiv(i, 1), masiv(i, 2), masiv(i, 3)
Next i
Close #1
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question