Search:

Type: Posts; User: nucleon

Page 1 of 3 1 2 3

Search: Search took 0.01 seconds.

  1. Replies
    23
    Views
    4,157

    I didn't realize this place was full of a bunch...

    I didn't realize this place was full of a bunch of unix snobs.
    Goodbye.
  2. Replies
    11
    Views
    1,197

    -- i thought there is no true/false in C only 0...

    -- i thought there is no true/false in C only 0 and not 0
    Including <stdbool.h> as master5001 suggests adds "bool", "true", and "false",
    although it is simple to define it yourself as matsp points...
  3. Thread: Abracadabra!

    by nucleon
    Replies
    6
    Views
    4,997

    You'll also need to eat the newline after reading...

    You'll also need to eat the newline after reading the first five characters. So after your first for-loop you'll need an extra getchar(). Actually, there are better ways to read strings, but maybe...
  4. Replies
    23
    Views
    4,157

    A few problems: * You entered the terminating 0...

    A few problems:
    * You entered the terminating 0 into the queue.
    * You've ignored the rear pointer.
    * You've created a stack, not a queue (i.e., following the "front" pointer prints out the input...
  5. Replies
    23
    Views
    4,157

    Since no one else is touching this, here's a...

    Since no one else is touching this, here's a rewrite. Study the changes carefully, especially those involving pointers.


    #include <stdio.h>
    #include <malloc.h>

    struct node
    {
    int info;
    ...
  6. Thread: Flow Chart

    by nucleon
    Replies
    2
    Views
    2,945

    Can you upload it in a different format? A gif or...

    Can you upload it in a different format? A gif or jpg perhaps?
  7. Replies
    3
    Views
    1,232

    So your question is why does *pname output a...

    So your question is why does *pname output a single char while pname outputs the entire string? pname is a pointer to char, so *pname is a char, thus you get a char. Being a pointer to char, pname is...
  8. Replies
    5
    Views
    1,121

    Yes you can alter it. Usually, you also pass the...

    Yes you can alter it.
    Usually, you also pass the size of the array to a function:


    void show( int n[], int size)
    {
    while (size--) printf( "%d ", *n++);
    printf( "\n");
    }
  9. Replies
    14
    Views
    13,603

    You can simplify that, but you still need a bunch...

    You can simplify that, but you still need a bunch of defines.


    #include <conio.h>

    // Name some control-codes
    #define KEY_BEL 7
    #define KEY_BS 8
    #define KEY_TAB 9...
  10. Replies
    15
    Views
    11,297

    You don't need to convert to binary since...

    You don't need to convert to binary since everything in a computer is already in binary. To "XOR two strings" may mean this:


    char s1[] = "abcdefg";
    char s2[] = "hijklmn";
    int i;
    for (i = 0;...
  11. str2 needs to have at least 2 characters in order...

    str2 needs to have at least 2 characters in order to contain the terminating null char. So str2[2].
    Or you could make str2 a char instead of an array and use strchr instead of strstr.
  12. Replies
    11
    Views
    2,810

    Post the code, preferably the least code that...

    Post the code, preferably the least code that duplicates the problem.
  13. Replies
    2
    Views
    17,278

    The return value is a thread id. Try this for the...

    The return value is a thread id. Try this for the process id.


    DWORD pid;
    DWORD tid = GetWindowThreadProcessId( hwnd, &pid);
  14. Replies
    20
    Views
    43,023

    /K keeps the console open while /C closes it...

    /K keeps the console open while /C closes it afterwards.
  15. Replies
    1
    Views
    947

    Looks like you're compiling a cpp file as a c...

    Looks like you're compiling a cpp file as a c file.
    Try changing the filename to whatever.cpp.
    Make sure you're compiling a cpp project.
  16. Replies
    20
    Views
    43,023

    This works for me: int main() { ...

    This works for me:


    int main()
    {
    STARTUPINFO si = {sizeof(STARTUPINFO)};
    PROCESS_INFORMATION pi;
    CreateProcess( "C:\\Windows\\System32\\cmd.exe",
    " /K echo...
  17. Replies
    24
    Views
    5,204

    Here's a strtok replacement I wrote that returns...

    Here's a strtok replacement I wrote that returns non-space delimiters as tokens also. Spaces are automatically considered delimiters but are not returned.


    #include <iostream>
    #include <cstring>...
  18. Replies
    3
    Views
    1,001

    EnumWindows takes a function pointer to a...

    EnumWindows takes a function pointer to a callback function which is passed the window handles one at a time (and an application-defined LPARAM):


    BOOL CALLBACK
    enumWindowsProc( HWND hwnd,...
  19. Replies
    20
    Views
    43,023

    To send commands to cmd from the command line,...

    To send commands to cmd from the command line, you must use either the "/C" or "/K" switches. Look at "help cmd". So your call to runScripts would be e.g.:


    runScripts( " /K echo howdy");

    You...
  20. fgets() reads from the file into a...

    fgets() reads from the file into a null-terminated string. The EOF is not stored. EOF is not even actually a character. It is an int so that its bit-pattern can be distinguished from all chars. The...
  21. I've written only one small client/server program...

    I've written only one small client/server program before and I'm not sure how peer-to-peer is different. I guess I'm lost in the nomenclature itself. For instance, where do sockets fit into this?...
  22. Replies
    7
    Views
    24,511

    You are missing a few braces. And notice how more...

    You are missing a few braces. And notice how more careful indenting makes it easier to read.


    #include< stdio.h>

    int main()
    {
    int num;
    int oddcount, evencount;
  23. Look up AllocConsole() on MSDN.

    Look up AllocConsole() on MSDN.
  24. Best communication choice for two-person card game.

    If I wanted to make a card game between two people to be played over the internet, which is better, client/server or peer-to-peer? Are there other alternatives?
  25. Replies
    14
    Views
    13,603

    Yes, the numeric code for escape is 27. Function...

    Yes, the numeric code for escape is 27. Function and arrow keys give two numeric codes in a row, taking two iterations of the loop.

    There may be a higher-level way of detecting them. Windows has...
Results 1 to 25 of 60
Page 1 of 3 1 2 3