Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Saving text file to a specific directory


Reply
 
Thread Tools Display Modes
  #1  
Old 02-21-2003, 05:04 PM
Brian1's Avatar
Brian1 Brian1 is offline
Centurion
 
Join Date: Dec 2002
Location: Washington State, USA
Posts: 131
Default Saving text file to a specific directory


I have a program that opens a file for random access. When processing this file sometimes I want to save a copy of the file to a specific directory. How do I do this?

Code:
Sub CheckRawData() Dim Transaction As TransactionNew Dim FileNum As Integer Dim RecordLen As Long Dim Position As Long ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 'SET LINE POSITION AND OPEN RAW FILE Position = 2 RecordLen = Len(Transaction) FileNum = FreeFile Open RawFile For Random As FileNum Len = RecordLen Get FileNum, Position, Transaction ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 'LOOP THROUGH EACH RECORD AND CHECK FOR ERRORS IN THE DATA While EOF(FileNum) <> True Get FileNum, Position, Transaction Position = Position + 1 testvar = Asc(Transaction.Spacer) testvar2 = Asc(Transaction.MachineNum) If Asc(Transaction.MachineNum) = 0 Then MsgBox "you have reached the end of the file", vbOKOnly Exit Sub End If If Not IsNumeric(Transaction.MachineNum) Then MsgBox "there is an error in the file", vbOKOnly FileError = True 'THIS IS WHERE I WANT TO SAVE THE FILE TO A DIRECTORY!! Exit Sub End If Wend ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' End Sub
Reply With Quote
  #2  
Old 02-21-2003, 05:06 PM
Squirm's Avatar
Squirm Squirm is offline
Political Coder

Retired Moderator
* Guru *
 
Join Date: Mar 2001
Location: London, England
Posts: 8,037
Default

Example:

Code:
FileCopy "C:\sourcefile.txt", "C:\backup\destfile.txt"
__________________
Search the forums | Use [vb][/vb] tags | Still IRCing
Reply With Quote
  #3  
Old 02-21-2003, 05:13 PM
Brian1's Avatar
Brian1 Brian1 is offline
Centurion
 
Join Date: Dec 2002
Location: Washington State, USA
Posts: 131
Default

simple enough!

thanks
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->