open a console from a GUI in c++

This is a discussion on open a console from a GUI in c++ within the Linux Programming forums, part of the Platform Specific Boards category; I've to comunicate with a GSM modem connected in a USB port...how I can sent AT comend to it? Is ...

  1. #16
    Registered User
    Join Date
    Jan 2008
    Posts
    35
    I've to comunicate with a GSM modem connected in a USB port...how I can sent AT comend to it? Is it seen by OS like a tty?

    Lollo

  2. #17
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Assuming the USB driver in your Linux distro is working correctly, it should be detected as a serial port, which is [usually] a ttySn where n is a number.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #18
    Registered User
    Join Date
    Jan 2008
    Posts
    35
    Ok I try ... ehm...how i can identify it between the n-thousands of tty in /dev? can I try to comunicate with modem by a terminal, if yes, how ?
    Excuse for my elementary questions, but I'm from windows and I've to learn how to do the same thinks (or better) in Linux...I want develop my applications in Linux, no more in window$ :-)
    Lollo

  4. #19
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    You can probably use "lsusb" to list the device itself. Then you should be able to identify it in "dmesg" - if not, unplug it and plug it back in, and do "dmesg|tail" - hopefully the device driver is showing what device it creates.

    Minicom is one of the terminal programs for Linux, so you should be able to use that:
    http://en.wikipedia.org/wiki/Minicom

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #20
    Registered User
    Join Date
    Jan 2008
    Posts
    35
    with lsusb I identify the device:
    Bus 001 Device 005: ID 0f94:0005
    but how I can use this info? :-(

  6. #21
    Registered User
    Join Date
    Jan 2008
    Posts
    35
    I've done!!! and is all OK....you are a great friend! you save me another time from an headache.

    thanks,thanks,thanks,thanks

  7. #22
    Registered User
    Join Date
    Jan 2008
    Posts
    35
    I would open the terminal programmatically to show log file with this code:

    string cmd;
    cmd="tail -f " + (string)DbgFileName;
    system(cmd.c_str());

    but when I run the application i receive sthe message:

    Stopped due to shared library event
    [Thread debugging using libthread_db enabled]
    [New Thread -1231440192 (LWP 26131)]
    Stopped due to shared library event

    what is wrong?

    Thx
    Lollo

  8. #23
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by lollobrigido View Post
    I would open the terminal programmatically to show log file with this code:

    string cmd;
    cmd="tail -f " + (string)DbgFileName;
    system(cmd.c_str());

    but when I run the application i receive sthe message:

    Stopped due to shared library event
    [Thread debugging using libthread_db enabled]
    [New Thread -1231440192 (LWP 26131)]
    Stopped due to shared library event

    what is wrong?

    Thx
    Lollo
    You probably would need to run that in the debugger - "gdb yourapp" - if you add "-g" to the compiler flags, it will most likely give you the exact location.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  9. #24
    Registered User
    Join Date
    Jan 2008
    Posts
    35
    I'm debugging and i have -g3 in the compiler options.
    The code is correct for you to launch the command?

    Lollo

  10. #25
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Looks fine to me. What happens if you do that in a small C++ program on it's own?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  11. #26
    Registered User
    Join Date
    Jan 2008
    Posts
    35
    If I put this piece of code in a small program it work fine!!!

  12. #27
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Is there a particular reason you can't just start the tail -f yourself? It seems like a lot of work for something that you can do quite trivially without code.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  13. #28
    Registered User
    Join Date
    Jan 2008
    Posts
    35
    No, I would like to do that in automatic and understand how to...but it's not mandatory

  14. #29
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Have you tried setting a breakpoint at the beginning of the function, and stepping along those lines of code?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  15. #30
    Registered User
    Join Date
    Jan 2008
    Posts
    35
    yes...I found that when execute the "system(cmd.c_str())" the debugger lost the control

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. DOS / Linux Console based GUI?
    By mart_man00 in forum C Programming
    Replies: 3
    Last Post: 09-14-2002, 01:46 AM
  2. Problems with open and save boxes
    By pinkcheese in forum Windows Programming
    Replies: 3
    Last Post: 05-21-2002, 07:03 PM
  3. .NET And GUI Programming :: C++
    By kuphryn in forum C++ Programming
    Replies: 4
    Last Post: 01-27-2002, 04:22 PM
  4. GUI Programming :: C++ Exclusive
    By kuphryn in forum C++ Programming
    Replies: 5
    Last Post: 01-25-2002, 03:22 PM
  5. Ghost in the CD Drive
    By Natase in forum A Brief History of Cprogramming.com
    Replies: 17
    Last Post: 10-12-2001, 06:38 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21