Jump to content

SUBIECTE NOI
« 1 / 5 »
RSS
Croaziera in Mediterana de Vest 1...

Copilot are pica pe Vladimir Putin

MicroSoft Edge: Cum pun Google in...

Dashcam
 Mini server - VMware

betano.ro

Poveste fara sfarșit

I-auziti voi! - nu vor romani...
 Colon iritabil

Perioada de gratie inexistenta

Cel mai ieftin TV LED mic

Reverse proxy si htaccess pe Raps...
 Statie de epurare sau fosa septic...

"enerlux p" afisaj interm...

Adaptor usb3.1gigabit vs Adaptor ...

La multi ani @Atreides!
 

Text Files

- - - - -
  • Please log in to reply
1 reply to this topic

#1
S9yN37®

S9yN37®

    New Member

  • Grup: Members
  • Posts: 18
  • Înscris: 09.11.2005
Am un fisier txt care contine:
map1
map2
map3
il deschid le citesc, amestec cuvintele apoi le scriu:
"map2"
"map3"
"map1"
Intrebarea e cum fac sa nu`mi mai puna ghilimelele???

Programul:

Option Explicit
Dim Maps() As String
Dim RandMaps() As String

Private Sub cmdRandom_Click()
Dim GN As Integer ' numa generat
Dim i As Integer
Dim y As Integer
Dim index As Integer
Dim NH As Integer
NH = NumarHarti("mapcycle.txt")
ReDim Maps(NH) As String

	Open "mapcycle.txt" For Input As #1
	For index = 1 To NH
	Input #1, Maps(index)
	Next index
	Close #1

ReDim RandMaps(NH) As String

For i = NH To 1 Step -1
	GN = Int((i * Rnd) + 1)
	RandMaps(i) = Maps(GN)
	Maps(GN) = "0"
	For y = 1 To i
		If Maps(y) = "0" And y <> i Then
		Maps(y) = Maps(y + 1)
		Maps(y + 1) = 0
		End If
	Next y
Next i

	Open "mapcycle.txt" For Output As #1
	For index = 1 To NH
	Write #1, RandMaps(index)
	Next index
	Close #1
Shell ("notepad.exe mapcycle.txt")
End Sub

Function NumarHarti(fisHarti As String) As Integer
Dim numeHarta As String
Dim lC As Integer
Open fisHarti For Input As #1
Do While Not EOF(1)
Input #1, numeHarta
lC = lC + 1
Loop
Close #1
NumarHarti = lC
End Function

___
mod edit: foloseste tag-urile de cod


Edited by RAZ, 14 April 2006 - 08:57.


#2
uu666

uu666

    New Member

  • Grup: Members
  • Posts: 23
  • Înscris: 23.08.2006
asta pentru ca folosesti "Write" ... foloseste "Print":

xxxx=RandMaps(index)
print #1,xxxx
insa asta va pune in fisier doar continutul lui xxxx... le faci pe toate si dupa aia le scrii.

Edited by uu666, 24 August 2006 - 08:42.


Anunturi

Bun venit pe Forumul Softpedia!

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Forumul Softpedia foloseste "cookies" pentru a imbunatati experienta utilizatorilor Accept
Pentru detalii si optiuni legate de cookies si datele personale, consultati Politica de utilizare cookies si Politica de confidentialitate