Hi there!

So I was at the offices of a bank today doing some work to their webpage, and I needed Internet Connectivity, so the networking guy told me to simply run the following .bat file:


; REGEDIT.EXE /S "%~f0"

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]

Didn´t work, it was time for me to go Home anyways so I left.

To my surprise, when I got home I didn´t have any Internet connection with Google Chrome nor Firefox, and have to use the dreaded IE to post this.

Also, everytime I try to access the Windows LAN options under Internet Options it crashes giving me a rundll32 error.

Anyon care to give me some pointers or command on how to revert what this command made? (I have very limited programming knowledge, I understand cero what these guy´s command did...)

[QUOTE=Ancient Dragon;1104585]My guess is that VALUES strings must be surrounded with single-tick quotes (unshifted double quotes on my keyboard).
[icode]sprintf(cmd, "INSERT INTO prueba VALUES('%s')", Name); [/icode][/QUOTE]

That was it, thanks!

I also changed the
mysql_query(conn, "INSERT INTO prueba VALUES(Name)"); [/CODE]


[CODE] mysql_real_query(conn, cmd, (unsigned int)strlen(cmd));[/CODE]

I'm trying to get some user data into an INSERT query using the Mysql C API (don't know if this belongs rather in the Mysql forum, let me know...)

I have the following code taking some pointers from the Mysql webpage forum, but to no avail:


include <mysql.h>
include <stdio.h>
include <stdlib.h>

int main()
char server = "localhost";
user = "root";
char password = / password to acces mysql /;
database = "palabra";

char Name[] = "test"; 
char *cmd; 

sprintf(cmd, "INSERT INTO prueba VALUES(%s)", Name); 
MYSQL *conn; 

mysql_real_connect(conn, server, user, password, database, 0, NULL, 0);
mysql_query(conn, "INSERT INTO prueba VALUES(Name)"); 
return 0; 



The code compiles without error, but the table is unchanged with nothing inserted to it.
More over, I don't really know the sprintf part too well, or why it's used (like I said I took pointers from other forums just to try stuff), since it's not used later when the mysql_query() is called.


Worked perfectly thanks!

I tried this
$ mv /home/juan/Desktop/Codigos\IVR/ppal.agi /var/lib/asterisk/agi-bin

but doesn't seem to work when I make it.
I'm kinda noob to makefiles

I have a makefile that creates a certain executable. This executable has to be in a certain directory to be able to run, so everytime I compile and make, i have to move it manually
Is there any way to tell the makefile to also move the file to a location.
For example, "test" is the output, what is the instruction to move from /home/user/Desktop to /var/lib/asterisk


Hey thanks for helping out.
The thing is this is a text to speech engine which I'm developing along with Asterisk (telephony PBX).
The caller inputs his ticket number, the database processes the ticket number and returns the string like "Your ticket number 123 is solved".
I have to be able to separate the words and numbers, because each word has a sound file linked to it.
For example, using the StreamFile function from Asterisk,
outputs the sound file your.gsm and the caller hears the recorded file.
But for the numbers, there's already a function that takes the whole number as an array and processes it, then outputing different sound files.
For example, for 123 it would output
so the caller hears one hundred twenty three.

Thats why I have to take the numbers from the string that is tokenized and store them in arrays.
Since functions can't take arrays as arguments, I'm thinking passing the pointer to it that strtok saves as the word or number in this case, and then inside the TTS function make the pointer go over the word, saving each character to an array. In the end, I would want to have an array, in this example, of this kind

It all boils down to the numbers being in an array, coming from the tokenized phrase which are saved with pointers, right?

how would this be done
[CODE]int main(void)
char string[]="231 number 73 word 1 2";
char ele;
ele=strtok(string," ");
while (ele != NULL)
if (
ele == '0' || ele == '1' || ele == '2' || ele == '3' || ele == '4' || ele == '5' ||
ele == '6' || ele == '7' || ele == '8' || *ele == '9')
printf("%s\n", ele);
ele=strtok(NULL," ");
return 0;

I'm trying to separate the words from the numbers. So when tokenizing it encounters a number I can pass it to an array.
the TTS function is what should be able to do it
[CODE]void TTS(char *punt)
int i=0;
char num[20]; //where I wanna store the number

for (i=0;i<20;i++)

for (i=0;i<20;i++)
              printf("%c",num[i]);  //checking if anything is stored


Output is:
which corresponds to the first printf in TTS, which I added to make sure that at least it prints the number as a string.

I'm newb, have trouble with pointers and arrays. I'm sure there's an easy way around this. Any help?

The result query would be something like:
"Your ticket number is 230 and is being handled by one of our assistants."

Just a char string with letters and numbers. I'm trying to separate the words from the numbers in a primitive way I know.
test is defined as:

[CODE]char test[20][35];[/CODE]

So I'm using Mysql to make a text-to-speech engine. Basically any given phrase by the database is returned to my script, which has to say every word and number, if any, by way of voice . For the voices I'm using Asterisk, but that's another problem of my own lol

The problem I'm having is this: the sql results are given in way of arrays, like this:
char test[10][20]

so test[0] is the first line of query, test[1] second and so on.

So I just use the strtok function on the array using " " (space) as the tokenizer and get the words. But strtok uses pointers as the words it stores, right?
How would I go about converting the word the pointer stores into an array? This would be helpful specially if there are any numbers, since I've already programed a function that reads an array of numbers and says it to Asterisk.

[CODE]while ((row = mysql_fetch_row(res)) != NULL)
/Copy the array to an auxiliary array for processing/
int i;
char num;

    /* Convert all letters to lowecase */
    for (i=0 ;test[0][i]; i++)
        test[0][i]= tolower(test[0][i]);

    /* Separate the phrase into words */
    char token[] = " ";
    char *word = NULL;
    word = strtok(test[0], token);

    /* If word is a number */       
    while (word != NULL) 
        if (*word == '0' || *word == '1' || *word == '2' || *word == '3' || *word== '4' || *word == '5' || 
                *word == '6' || *word == ...

Well if you know what Asterisk PBX is, as well as AGI and applications within Asterisk then you'll know what this is about.
I'm guessing since this is a programming forum people will know at least what the MySQL C API is, so I thought someone would know something.
Nonetheless thanks for posting.
I'm marking this as solved since I forgot last time.

Well, to anyone interested in this particular issue, I was able to solve it.
I simply changed the Stream File command to Exec Playback, which is essentially the same in Asterisk, but control goes over to Asterisk instead of the AGI script, if i recall correctly.


Hello. I'm currently developing an IVR system under Asterisk through the Asterisk Gateway Interface (AGI), connecting to a Mysql server using the Mysql C API.
The server returns a ticket number that I have to say to the client, so I developed a TTS (Text To Speech) algorithm to say a specific number (13000) to the client for testing, by using the AGI application Stream File, and playing two sound files back to back, thirteen.gsm and thousand.gsm, so the caller can hear the ticket number "Thirteen Thousand"
The problem is this: on the Asterisk debug console I can see that the Stream File ("thirteen") and Stream File("thousand") functions work, but can hear no sound whatsoever on the softphone. The sound files play fine on other sound players and so do other AGI applications using the Stream File function.

The code below basically copies the number returned by the server (13000 for this test) on the array 'numero', then checks the first and second numbers to be '1' and '3' (I omit the latter since I know they're zero) then play the files through the AGI functions Stream File.
I'm guessing it has to do with being connected to the server while playing files or something.
Any ideas?
[CODE]while ((row = mysql_fetch_row(res)) != NULL)
for (i=0; i<j; i++)
if (prueba[0][i]=='0' || prueba[0][i]=='1' || prueba[0][i]=='2' || prueba[0][i]=='3' || prueba[0][i]=='4' || prueba[0][i]=='5' ||
prueba[0][i]=='6' || prueba[0][i]=='7' || prueba[0][i]=='8' || prueba[0][i]=='9')

            //printf("El string comienza en posicion %i\n",i);
            for ...
jephthah commented: nice to see someone's first post, with properly formatted code. +5