[Gambas-user] notal noob: creating a file

Eilert eilert-sprachen at ...221...
Fri Mar 18 09:48:11 CET 2005


Hi Bill,

Try this one:

OPEN file_name FOR WRITE CREATE AS #File_Post

does that do it?

Rol
f

oops too fast

Rolf



bill schrieb:
> Hi there!  I'm just picking up gambas for the first time.  I'm starting with a 
> basic little app, but I've run into my first snag.  I also can't quite seem 
> to find any help in the tutorials or docs to answer this question.
> 
> The snippet is supposed to create a file, with a timestamp as the filename.
> 
> here's the relevant code:
> ----------
>   DIM File_Post AS File
>   DIM file_name AS String
>   DIM arystrDate AS String[]
>   DIM arystrTime AS String[]
>   
>   'get date in YYYY-MM-DD format
>   arystrDate = Split(Date.Text, "/")
>   file_name = arystrDate[2] & "-" & arystrDate[0] & "-" & arystrDate[1]
> 
>   'get time in HH-mm-SS format
>   arystrTime = Split(Time.Text, ":")
>     file_name = file_name & "_" & arystrTime[0] & "-" & arystrTime[1] & "-" & 
> arystrTime[2]
>   
>   ' for sanity, lets see if the filename matches what I think it should be
>   lblFileName.Text = file_name
> ----------
> 
> what do I put next though?  
> 
> I've tried:
> OPEN file_name FOR CREATE AS #File_Post
> 
> but that gives me a "file does not exist error".  Which I thought CREATE would 
> take care of.
> 
> Then I figured I'd throw a "WRITE" in there, after the CREATE, but that just 
> gives me a syntax error.  I considered just using "touch" from within the 
> program to create the file, but that seems silly.
> 
> Also, in some tutorials, I see the file reference with a # in front of it, and 
> sometimes not.  What's that all about?
> 
> Any help is appreciated!
> Bill Sanders
> 
> 
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
> 





More information about the User mailing list