Absolutely Baffled!! SMS sending AT commands

Hi, I can't figure this out. I am trying to send a text message using AT commands and a modem using C++. The code successfully writes to the com port exactly what i want it to, however i have to trigger the same piece of code twice for it to send the text, and even then it then sends the whole commands, better explained- it will send a text that says "at+cmgf=1.at+cmgs="+44*******.message"

I cant work it out, I've put in delays with no luck and tried all sorts. I tried to read in what the modem was sending out to the serial port using readfile also with no luck as I thought that might have to be done before sending it the message contents or something.

Any help would be much appreciated!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
  //write ComPort
			char valor4[26] = ("at+cmgf=1");
			BOOL bWriteRC4;
           static DWORD iBytesWritten4;
             bWriteRC4 = WriteFile(hComm, &valor4, 9, &iBytesWritten4,NULL);

			   char valor6 = carr;
			BOOL bWriteRC6;
           static DWORD iBytesWritten6;
             bWriteRC6 = WriteFile(hComm, &valor6, 1, &iBytesWritten6,NULL);

			
			char UitBuff[25];
			DWORD dwBytesRead;
			ReadFile(hComm, UitBuff, 20, &dwBytesRead, NULL);
	       
        
		    char valor[26] = ("at+cmgs=\"+44*********\"");
			BOOL bWriteRC;
           static DWORD iBytesWritten;
             bWriteRC = WriteFile(hComm, &valor, 23, &iBytesWritten,NULL);
		

			 char valor5 = carr;
			BOOL bWriteRC5;
           static DWORD iBytesWritten5;
             bWriteRC5 = WriteFile(hComm, &valor5, 1, &iBytesWritten5,NULL);
	

		    char valor2[17] = ("test2");
			BOOL bWriteRC2;
           static DWORD iBytesWritten2;
             bWriteRC2 = WriteFile(hComm, &valor2, 5, &iBytesWritten2,NULL);
            
			  
			 char valor3 = ctrlz;
			BOOL bWriteRC3;
           static DWORD iBytesWritten3;
             bWriteRC3 = WriteFile(hComm, &valor3, 1, &iBytesWritten3,NULL);
	       
			
			//Close ComPort
			CloseHandle(hComm);

Last edited on
I suggest You to delete the phone number from this forum just to ensure that noone will abuse it...
ahhh THANKS!! Completely forgot the phone number was in there!
Are you reading enough prompt characters after you send the phone number?
Have worked it out! :) thanks for help though!
Topic archived. No new replies allowed.