Saving Data Blues.
Blitz3D Forums/Blitz3D Programming/Saving Data Blues.| 
 | ||
| Hello All :) Im always stuck with doing this with streams. What's supposed to happen is a file created with data setout, in so many across, and so many going down. I am using the ,_ for the end of line and { } to export out ao that another reader will be able to deal with interpreting the info / data. And it'll be multi-lingual. 
Const AmountX=8, AmountY=12
Global TotalInfo=AmountX*AmountY
Dim Info( TotalInfo )
Function SaveInfo( SaveFile$ )
   	
    FileOut=WriteFile( SaveFile$+Str(".txt") )
    ;
    ; sort out file values
    ;
    For Index = 0 To TotalInfo-1
        
		;
		; Have we reached the very Last entry?
		;
        If Index = TotalInfo-1 Then
        	WriteLine Fileout, Str( Info(Index))+" }" 
		Else
            
			If LineCount < AmountPerLine Then
  				;
				; Carry on as usual with adding a comma between data.
				;
				WriteLine FileOut, Str(Info( Index ))+","
			Else
          		;
				; Cool, I see we have reached the end of the current line, signified by adding ,_
				;
				WriteLine FileOut, Str(Info( Index ))+",_"
				LineCount = 0
            End If
        End If
        
		LineCount = LineCount + 1
	Next
	CloseFile FileOut
End Function
Cheers for sorting me out, Clyde. | 
| 
 | ||
| Maybe you can use a string as a temp. buffer to create the line before writing it to the file: 
s$ = ""
for x = 0 to 10
  if x < 10 then 
    s$ = s$ + Info$(x) + "," 
  else 
    writeline ff, s$ + Info$(x) + "_"
  endif
next
 |