what are you "programming" right now?

Just starting out? Need help? Post your questions and find answers here.
debaser
New User
New User
Posts: 7
Joined: Tue May 10, 2005 1:59 pm

what are you "programming" right now?

Post by debaser »

hello. i'm new. i'm a newbie.
nice to meet this community.

my question is simple. what do you do with pure basic? what are you workin on right now?

i'm writing a simple application with 2 buttons: "browse" and "send".
this stupid program let you search in your hard drive an audio file and send it to a specified FTP server. then it sends an email with the link (like: ftp.server.com/mysong.mp3) to the rest of my band. not so useful but quite amazing for me right now. i'm writing it because the other musicians of my band don't now how to use an ftp client and we need to listen our ideas every day.

my little question: the program use an external TXT file where i wrote the SMTP server address and the email of my friends.

like :

Code: Select all

smtp.server. com
mail@mail.com
mail2@mail. com
i used this code

Code: Select all

If ReadFile(0, "server.txt")

          server$ =  Trim(ReadString())
    
       CloseFile(0)
so my app read the server address. but how can i teach him to read on the second line the first email address and on the 3rd line the second email address?




bye

marco[/code]
debaser
New User
New User
Posts: 7
Joined: Tue May 10, 2005 1:59 pm

Post by debaser »

sorry i now that this topic should be in the beginner page

:oops:
User avatar
NoahPhense
Addict
Addict
Posts: 1999
Joined: Thu Oct 16, 2003 8:30 pm
Location: North Florida

Post by NoahPhense »

Quite easy..

Code: Select all

If ReadFile(0, "server.txt") 
  line1$ = Trim(ReadString())
  line2$ = Trim(ReadString())
  line3$ = Trim(ReadString())
  CloseFile(0)
Else
  ; could not read the file
EndIf
- np
User avatar
Joakim Christiansen
Addict
Addict
Posts: 2452
Joined: Wed Dec 22, 2004 4:12 pm
Location: Norway
Contact:

Post by Joakim Christiansen »

I'm currently working on a strategy game, and I want it to be almost like RedAlert.
I don't think I ever will finish it, but I'll work until I get stuck. :lol:
I like logic, hence I dislike humans but love computers.
Num3
PureBasic Expert
PureBasic Expert
Posts: 2812
Joined: Fri Apr 25, 2003 4:51 pm
Location: Portugal, Lisbon
Contact:

Post by Num3 »

LoL,

I'm just working in an idea about paralel encryptation with diferent algorithms on the same stream.

You need a key and a password.

Key defines the 'order' of how the paralel algo's start their work, and the key makes the salt element over the encryptation...

Another use for this algo is to make Hash keys which are *almost* impossible to repeat / crack.
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post by GedB »

debaser,

I know I should be encouraging you to use PB, but for sending FTB REBOL really does make it easy. The core engine is free!

http://www.rebol.com/docs/core23/rebolc ... section-11
debaser
New User
New User
Posts: 7
Joined: Tue May 10, 2005 1:59 pm

Post by debaser »

no please....no more software :)

ok. i'll be really boring.
i'm using FTP_LIP
what i can't do is:


....to find the file to upload

Code: Select all

SongName$ = OpenFileRequester("Scegli il file da caricare", "", "Audio files|*.mp3;*.wav;*.wma|All Files|*.*", 0)
and then....

Code: Select all

FTP_UploadProgress("server","user","pass",21,"new",SongName$,WHATIPUTHERE???? ,#Bar)  
 
so ok "whatiputhere" is my issue. this is the place to put the name of the file as it will be on the server. if i put "SongName$" it doesn't work. if i put a name like "mysong.mp3" it works. but i would like it to preserve the name of the source file. i think it has to do with string conversion. but i can't handle it. can you help me?
last thing. i've tried to access my own ftp server (that i have on my computer) and it works well. it doesn't work when i try to connect to my remote server. does it makes sense?

thanks a lot.
you are great.
marco
User avatar
Paul
PureBasic Expert
PureBasic Expert
Posts: 1285
Joined: Fri Apr 25, 2003 4:34 pm
Location: Canada
Contact:

Post by Paul »

First off, OpenFileRequester() will include the full path from your harddrive as well as file name so "SongName$" could contain "C:\My Files\mysong.mp3" which of course is invalid for FTP file path.

You need to use SongName$=GetFilePart(SongName$) which will then return "mysong.mp3"

Next you must know exact path on FTP server where the files must go...
You then supply this in the "Dir" field. In your example you have "new" in this field so the "new" folder MUST exist on the server you are sending to.
Image Image
debaser
New User
New User
Posts: 7
Joined: Tue May 10, 2005 1:59 pm

Post by debaser »

yes it works!
thanks a lot guys.
wow.
Post Reply