|
-
Jul 31st, 2002, 05:33 AM
#1
Thread Starter
Member
Writing to a file
Hi,
I know this is pretty easy but I'm afraid I'm stuck at it:
I want to open a text file (which is fine) and format the contents of it to be in different positions. ie. There are 5 rows of data and i just need each row to be in a different position in the file(I've got the numbers of the positions) Is it best to write out the contents to it to a new file.
Not sure how to do this?
-
Jul 31st, 2002, 05:36 AM
#2
Retired VBF Adm1nistrator
Can you give us an example of what you want done ?
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Jul 31st, 2002, 05:43 AM
#3
Thread Starter
Member
Originally posted by plenderj
Can you give us an example of what you want done ?
Yes,
I'm afraid this is all i've done so far
strUnformattedFile = App.Path & "\" & App.EXEName & "\" & "strFile.txt"
intFile = FreeFile
Open strUnformattedFile For Input As intFile
strLine = Input(1, #1)
intCounter = intCounter + 1
-
Jul 31st, 2002, 05:45 AM
#4
Retired VBF Adm1nistrator
No no, what do you want to do ?
Swap the order of the lines, reverse each line, move each line in by a few spaces ...?
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Jul 31st, 2002, 05:50 AM
#5
Thread Starter
Member
Originally posted by plenderj
No no, what do you want to do ?
Swap the order of the lines, reverse each line, move each line in by a few spaces ...?
just move each line by a space or two
-
Jul 31st, 2002, 05:52 AM
#6
Retired VBF Adm1nistrator
So you want to indent lines a bit ?
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Jul 31st, 2002, 05:55 AM
#7
Thread Starter
Member
Originally posted by plenderj
So you want to indent lines a bit ?
yes, they have to be in the correct position,this is one line of the file. I need 10 spaces and not 11 between the first row and 2nd row and i'll need a few spaces between the 2nd last row and last row. I think the best way is to write out to another file but i'm not sure what the syntax is for outputing to a file
eg.1GNPA10 552721II5 A 3000000EUR
-
Jul 31st, 2002, 05:57 AM
#8
Retired VBF Adm1nistrator
Uhn you're talking about spacing out rows, but that sample there shows spaced out columns.
Which is it to be ?
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Jul 31st, 2002, 06:14 AM
#9
Thread Starter
Member
Originally posted by plenderj
Uhn you're talking about spacing out rows, but that sample there shows spaced out columns.
Which is it to be ?
Yes but it has to be the correct amount of spacing
ie. the first row has to have 10 spaces between it and the second row.
What i'm wondering is do i write the changes to a new file or is it possible to make the changes within the existing file?
Sorry for the confusion
-
Jul 31st, 2002, 06:18 AM
#10
Retired VBF Adm1nistrator
Uhn. You're being confusing again.
Two examples. Which one is correct :
Spacing Columns :
Code:
a b c d e f
g h i j k l
m n o p q r
'' turns into
a b c d e f
g h i j k l
m n o p q r
Spacing Rows :
Code:
a b c d e f
g h i j k l
m n o p q r
'' turns into
a b c d e f
g h i j k l
m n o p q r
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Jul 31st, 2002, 06:28 AM
#11
Thread Starter
Member
spacing between the columns:
ie.
I need to format this line to look like the following line
Code ID stat amount loc
1GNPA10 023551AJ3 C 5000000DTC
1GNPA10 023551AJ3 C 5000000 DTC 500000000
So that between the 1st and 2nd column, there is 10 spaces and 3 spaces between the 2nd and 3rd.
ie. code is = (1,6) position
id = (18,12) ""
stat = (30,1) ""
-
Jul 31st, 2002, 10:49 AM
#12
Retired VBF Adm1nistrator
Can you show me some sample lines from your data file ?
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|