Convertir un fichier ASCII

cs_darkbol Messages postés 61 Date d'inscription lundi 7 juin 2004 Statut Membre Dernière intervention 6 décembre 2004 - 23 juin 2004 à 09:27
cs_darkbol Messages postés 61 Date d'inscription lundi 7 juin 2004 Statut Membre Dernière intervention 6 décembre 2004 - 23 juin 2004 à 12:55
Bonjour,

j'aimerais savoir comment d'un fichier ascii type :

!Coordinate System:
! Projection System ID: 0 Initialized Quick: 0
! Secondary Horizontal: Units: m Per/Meter: 1
! Geodetic Datum: EUROP50 Ellipsoid: INTNL
! Projection Method: Transverse Mercator
! Central Meridian: 3
! Base Parallel: 0
! Scale Factor: 0.9996
! FALSE Easting: 500000 m
! FALSE Northing: 0 m
! User Horizontal: Units: m Per/Secondary: 1
(T1,F20.5,T25,F16.5)
->0004 507210.7 6245180.0 507207.6 6247034.5 511326.2 6247043.5 511331.1 6245188.5
507210.7 6245180.0

passer à un fichier type type bln comme ca :

5
507210.700000000 6245180.00000000
507207.600000000 6247034.50000000
511326.200000000 6247043.50000000
511331.100000000 6245188.50000000
507210.700000000 6245180.00000000

J'ai commencé par un ptit

Open "H:\Surfin project of the fire\Charisma2Surfer\charisma_Licences.dat for Input as #1
Line Input #1, texte
retour = Chr$(13) + Chr$(10)
tout = texte
While Not EOF(1)
Input #1,texte
                tout=tout+retour+texte
                Wend


je voudrais bien mettre un if mais chais pas comment dire, si ces caractères sont les bon trucs, eh ben stocke les et fais en moi deux nouvelles colonnes avec plus de zero... heuuu..

je débute vraiment alors merci pour votre aide...

"j'aime bien les conversions... :-|

4 réponses

cs_darkbol Messages postés 61 Date d'inscription lundi 7 juin 2004 Statut Membre Dernière intervention 6 décembre 2004
23 juin 2004 à 10:20
euh ptet que c un peu plus clair comme ca pour le premier fichier...

[g]
!Coordinate System:
! Projection System ID: 0 Initialized Quick: 0
! Secondary Horizontal: Units: m Per/Meter: 1
! Geodetic Datum: EUROP50 Ellipsoid: INTNL
! Projection Method: Transverse Mercator
! Central Meridian: 3
! Base Parallel: 0
! Scale Factor: 0.9996
! FALSE Easting: 500000 m
! FALSE Northing: 0 m
! User Horizontal: Units: m Per/Secondary: 1
(T1,F20.5,T25,F16.5)
->0004
507210.7 6245180.0
507207.6 6247034.5
511326.2 6247043.5
511331.1 6245188.5
507210.7 6245180.0/g

"j'aime bien les colonnes... :-|
0
cuq Messages postés 345 Date d'inscription mardi 3 juin 2003 Statut Membre Dernière intervention 21 mars 2008 2
23 juin 2004 à 12:27
Salut ,

Pour le formatage tu peux utiliser un truc du genre

Format(val,"####0.000000000") Mais attention dans ce cas tu devras avoir au niveau de tes paramètres régionnaux de Windoyws le point comme séparateur décimal et pas la virgule sinon tu aura une sortie -> 507210,700000000

pour relire les code ( si toute tes valeurs sont sur une ligne )utilise

Dim TabSplit

TabSplit = Split(texte, " ")

if Ubound(Tabsplit) >4 then

Print #2, Format(Tabsplit(1),"####0.000000000") ,Format(Tabsplit(2),"####0.000000000")
endif

Enfin des trucs comme ca ..
0
cs_darkbol Messages postés 61 Date d'inscription lundi 7 juin 2004 Statut Membre Dernière intervention 6 décembre 2004
23 juin 2004 à 12:52
merci

mais j'arrive déjà pas à trier ce que je veux de ce que je ne veux pas et mon while not EOF(1) ne senble pas s'arrêter..

Dim texte As String, tout As String, keyascii As Integer
 	Open "H:\Surfin project of the fire\Charisma2Surfer\test00.dat" For Input As #1
Line Input #1, texte
retour = Chr$(13) + Chr$(10)
tout = texte
While Not EOF(1)
While Not keyascii = 0
Select Case keyascii
Case 32
    Line Input #1, texte
    tout=tout+retour+texte
Case Else
keyascii = 0
End Select
Wend
    Wend
    Open "H:\Surfin project of the fire\Charisma2Surfer\test01.dat" For Output As #2
    Print #2, tout


après je pourrai essayer le format...
"j'aime bien les nuages... :-|
0
cs_darkbol Messages postés 61 Date d'inscription lundi 7 juin 2004 Statut Membre Dernière intervention 6 décembre 2004
23 juin 2004 à 12:55
euh je crois que c'est pas très judicieux de mettre
while not keyascii = 0
mais même sans c le même résultat...

"j'aime bien les erreurs bêtes... :-(
0
Rejoignez-nous