GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 03-Jun-2004, 06:19
labamba labamba is offline
New Member
 
Join Date: Jun 2004
Posts: 4
labamba is on a distinguished road

Store Bluetooth remote address to a text file


Hi there!

Using the code below I am able to discover the bluetooth address of a remote host and print it on the screen.

However, I would like to 'get' this bluetooth address, before printing on the screen, and store it in a text file on my PC.

How am I supposed to do that?

Thanks a lot.

The code to scan for other bluetooth devices:
CPP / C++ / C Code:
SOCKADDR_BTH *pAddrBthLocal=(SOCKADDR_BTH*)pCSAddrDevices->LocalAddr.lpSockaddr;	AddrBthLocal.btAddr=pAddrBthLocal->btAddr


The code to print the remote bluetooth device's address on the screen:

CPP / C++ / C Code:
                                                                                     addressSize = sizeof(addressAsString);
                                if (0 == WSAAddressToString(pCSAddrDevices->RemoteAddr.lpSockaddr, pCSAddrDevices->RemoteAddr.iSockaddrLength, 
			&protocolInfo, addressAsString, &addressSize)){
			UpdateData(true);
			Aux.Format("Remote Address: %s\n", addressAsString);
			m_SocketInfo.operator +=(Aux);
			UpdateData(false);
Last edited by dsmith : 03-Jun-2004 at 07:21. Reason: Please use [c] & [/c] for syntax highlighting
  #2  
Old 03-Jun-2004, 23:48
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,435
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all
Instead of the statement you use to print to the screen, open a file and write to the file. Simple -- unless I'm missing something...
__________________

Definition: Politics
Latin, from
poly meaning many and
tics meaning blood sucking parasites
-- Tom Smothers
  #3  
Old 06-Jun-2004, 20:45
Max Payne's Avatar
Max Payne Max Payne is offline
Regular Member
 
Join Date: Apr 2004
Location: 3° 08 North 101° 42 East
Posts: 332
Max Payne is a jewel in the roughMax Payne is a jewel in the roughMax Payne is a jewel in the rough
Quote:
Originally Posted by labamba
Hi there!

Using the code below I am able to discover the bluetooth address of a remote host and print it on the screen.

However, I would like to 'get' this bluetooth address, before printing on the screen, and store it in a text file on my PC.

Aux must be of CString class, so just open a new file and write the file with the Aux data, ...

CPP / C++ / C Code:
                                                                                     addressSize = sizeof(addressAsString);
                                if (0 == WSAAddressToString(pCSAddrDevices->RemoteAddr.lpSockaddr, 
pCSAddrDevices->RemoteAddr.iSockaddrLength, 
&protocolInfo, addressAsString, &addressSize))
{
			UpdateData(true);
			Aux.Format("Remote Address: %s\n", addressAsString);
                                      //write to file here......
			m_SocketInfo.operator +=(Aux);
			UpdateData(false);
__________________
When you say "I wrote a program that crashed Windows," people just stare at you blankly and say "Hey, I got those with the system, for free." Linus Torvalds
  #4  
Old 14-Jun-2004, 06:56
labamba labamba is offline
New Member
 
Join Date: Jun 2004
Posts: 4
labamba is on a distinguished road
yeap, but how?

i am trying to use the ofstream command but with no luck
  #5  
Old 14-Jun-2004, 10:32
aaroncohn's Avatar
aaroncohn aaroncohn is offline
Regular Member
 
Join Date: Feb 2004
Location: Bay Area, CA.
Posts: 570
aaroncohn is a jewel in the roughaaroncohn is a jewel in the roughaaroncohn is a jewel in the rough
CPP / C++ / C Code:
#include <fstream>

using std::ofstream

int main()
{
  ofstream outFile;
  char path[255];

  cout << "Path: ";
  cin  >> path;

  outFile.open(path); // outFile.open(path,ios::app) -- for appending
  outFile << "The path of this file is " << path << '.';
  outFile.close();

  return 0;
}
__________________
-Aaron
  #6  
Old 09-Jul-2004, 06:15
labamba labamba is offline
New Member
 
Join Date: Jun 2004
Posts: 4
labamba is on a distinguished road
1st problem solved but Problem continuing...:

Now that i have the MAC address in a text file I was just wondering how I can 'graphically' show the stats of this text file (ie. that the mac address 0A:4h:3e:1b has been recorded 3 times at that time of the day etc.)?

I would really appreciate it if you could help me on this matter.

Thanks a lot


PS Should I change the format of the file (instead of .txt to use a .xml maybe?)
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
CD burner wont burn!! robertli55 Computer Hardware Forum 1 18-Jun-2004 10:53
Yet another CD burner problem: Lite-On LSC-24082K Erwin Computer Hardware Forum 1 22-May-2004 11:28
Can't view pages from another machine on the Intranet aevans Apache Web Server Forum 9 14-May-2004 02:26
Re: Programming Techniques WaltP C Programming Language 0 10-Mar-2004 00:56
How to search a huge text file for data? JdS MySQL / PHP Forum 7 27-May-2003 09:27

Network Sites: GIDNetwork · GIDApp · GIDBlog · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 21:56.


vBulletin, Copyright © 2000 - 2017, Jelsoft Enterprises Ltd.