Restored from previous forum. Originally posted by ferryman.
It would be very useful to have CGI and command line console support, both under Windows and Linux. I am working on a library to read/write from stdin/stdout and to get the enviroment variables. I then use MKCON.exe to set the console mode flag on the EXE, but are problems with doing things this way. To have these features bulit-in shouldn't be hard to do.
[Implemented] CGI and Console Support
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Franco.
Hi Folks,
didn't find some console mode commands like:
Print (prints stuff out on the command line)
Input (expects that you types some stuff in)
Beep (gives some sounds through the laudspeaker)
Cls (deletes the text screen)
Locate (moves the cursor to 'line,column' -> in text mode)
to be continued...
Would be nice to add some stuff like that to the language.
Have a nice day...
Franco
Hi Folks,
didn't find some console mode commands like:
Print (prints stuff out on the command line)
Input (expects that you types some stuff in)
Beep (gives some sounds through the laudspeaker)
Cls (deletes the text screen)
Locate (moves the cursor to 'line,column' -> in text mode)
to be continued...
Would be nice to add some stuff like that to the language.
Have a nice day...
Franco
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by wavemaker.
Well, ferryman, I've written a CGI library for Purebasic that handles some basic CGI operations (I've been told it's useful; even if it doesn't replace Php or MySql, it works!). You can find these functions in the library, downloadable from Paul's site http://www.reelmediaproductions.com:
* URLEncode(string.s): Convert a string to URL format (i.e. to be sent to a server).
* URLDecode(string.s): Decode an URL encoded string (i.e. to be read by a CGI program).
* StdIn(buffer.l): Transfer data to a string variable. The data will likely be URLencoded if it comes from a web client (that's why there's an URLDecode function included in this 'package' .
* StdOut(string.s): Transfer data from a string variable to , i.e. from a web server to a web client, or from your application to the console screen. I think a similar function (PrintN?) is supposed to be included in next version of PureBasic, but, until then, this one will do no harm.
* StdInSplit(field.l,boolean.l,string.s): Extract information from an URLEncoded string variable generated by an HTML form. It *must* be URLEncoded so not to confound the library with "=" and "&" signs, so use this function before decoding StdIn data with URLDecode. Form data comes in value pairs, like in this example: "message=Hi+this+is+Wavemaker&author=Wavemaker". You may likely want to have those values in separated strings, and that's the reason for this function. The first parameter is the number of order of the field you want to separate. The second is a boolean: if it equals to 0, the left side of the pair will be taken. If it's grater, the right side will. The string is the URLEncoded form data you want to 'split'.
* StdInLen(string.s): Obtain the number of fields of an URLEncoded string variable generated by an HTML form. It *must* be URLEncoded so not to confound the library with "=" and "&" signs, so use this function before decoding StdIn data with URLDecode. Form data comes in value pairs, like in this example: "message=Hi+this+is+Wavemaker&author=Wavemaker". You may likely want to know how many value pairs are present, and that's the reason for this function.
* GetEnv(variablename.s,buffer.l): Get the value of an environment variable of the system. The second parameter allocates memory for the resulting string (needed by the API, ask her about the GetEnvironmentVariable function).
* SetEnv(variablename.s,value.s): Set the value of an environment variable of the system. The result is greater than 0 if the function succeeds, 0 if it doesn't.
I hope you can use it for yor needs.
Regards,
Wavemaker
Juan Calderón Alonso
Registered user
Well, ferryman, I've written a CGI library for Purebasic that handles some basic CGI operations (I've been told it's useful; even if it doesn't replace Php or MySql, it works!). You can find these functions in the library, downloadable from Paul's site http://www.reelmediaproductions.com:
* URLEncode(string.s): Convert a string to URL format (i.e. to be sent to a server).
* URLDecode(string.s): Decode an URL encoded string (i.e. to be read by a CGI program).
* StdIn(buffer.l): Transfer data to a string variable. The data will likely be URLencoded if it comes from a web client (that's why there's an URLDecode function included in this 'package' .
* StdOut(string.s): Transfer data from a string variable to , i.e. from a web server to a web client, or from your application to the console screen. I think a similar function (PrintN?) is supposed to be included in next version of PureBasic, but, until then, this one will do no harm.
* StdInSplit(field.l,boolean.l,string.s): Extract information from an URLEncoded string variable generated by an HTML form. It *must* be URLEncoded so not to confound the library with "=" and "&" signs, so use this function before decoding StdIn data with URLDecode. Form data comes in value pairs, like in this example: "message=Hi+this+is+Wavemaker&author=Wavemaker". You may likely want to have those values in separated strings, and that's the reason for this function. The first parameter is the number of order of the field you want to separate. The second is a boolean: if it equals to 0, the left side of the pair will be taken. If it's grater, the right side will. The string is the URLEncoded form data you want to 'split'.
* StdInLen(string.s): Obtain the number of fields of an URLEncoded string variable generated by an HTML form. It *must* be URLEncoded so not to confound the library with "=" and "&" signs, so use this function before decoding StdIn data with URLDecode. Form data comes in value pairs, like in this example: "message=Hi+this+is+Wavemaker&author=Wavemaker". You may likely want to know how many value pairs are present, and that's the reason for this function.
* GetEnv(variablename.s,buffer.l): Get the value of an environment variable of the system. The second parameter allocates memory for the resulting string (needed by the API, ask her about the GetEnvironmentVariable function).
* SetEnv(variablename.s,value.s): Set the value of an environment variable of the system. The result is greater than 0 if the function succeeds, 0 if it doesn't.
I hope you can use it for yor needs.
Regards,
Wavemaker
Juan Calderón Alonso
Registered user