nbtstat inclution
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: nbtstat inclution

  1. #1
    Join Date
    Aug 2011
    Posts
    80

    nbtstat inclution

    Hi all,

    i've managed to include nbtstat in a program i'm working on, but there's something not working as it should.

    When i run nbtstat from my program, it starts, but shows no output to my console app. Ofcourse it does show output from the cmd line.

    I also tried writing the output to a text file, but the file is empty after running nbstat -A ip

    This is how i use the function:

    Code:
    void nbtstat()
    {
    	string user_input, lookup_again;
    	do {
    	system("cls");
    	cout << "\nEnter URL or IP: ";
    	cin.ignore(256,'\n');
    	getline(cin, user_input);
    	user_input.erase(remove_if(user_input.begin(), user_input.end(), IsSpaceOrCR), user_input.end());
    	system("cls");
    // Without the redirection to test.txt, the screen stays empty in the app.
    	system(("C:\\Windows\\System32\\nbtstat.exe -A " + user_input + " > %TEMP%\\test.txt").c_str()); 
    		system("pause"); // Only for debugging purpose.
                    cout << "Done." << endl;
    		cout << "\nTry again?" << endl;
    		cout << "\n(Y)es or (N)o: ";
    		cin >> lookup_again;
    	} while(lookup_again=="Y" || lookup_again=="Yes" || lookup_again=="y" || lookup_again=="yes");
    }
    Any ideas ? Or maybe a different way to get the information i need without nbtstat but with a C++ function ?

  2. #2
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,642

    Re: nbtstat inclution

    I don't know which function that does the same as nbstat but here's a link to a bunch of network functions http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    http://www.microsoft.com/visualstudio/eng/downloads

  3. #3
    Join Date
    Aug 2011
    Posts
    80

    Re: nbtstat inclution

    Quote Originally Posted by S_M_A View Post
    I don't know which function that does the same as nbstat but here's a link to a bunch of network functions http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx
    thanks for the link.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center