Thread: Program Control Help

  1. #1
    Registered User mattz's Avatar
    Join Date
    Nov 2001
    Posts
    52

    Exclamation Program Control Help

    Hello Board,
    I am having trouble with basic program control. I finally seem to understand structures, pointers and passing to functions. However, I need help with some program control. This program passes structure pointers to a function which then outputs to an HTML file. However the user needs to provide some text which is then passed as Text to website. The user then is prompted to change to Italics, Bold etc which is passed to function and manipulated there. I just can't comprehend how to setup menu. 1 for accepting the change 0 to not accept the change. Here is what I Have thus far (edited):

    int in_response;

    fflush(stdin);

    printf("Please type some text for your web page and press enter");
    scanf("%c",&txtinput.txt);

    fflush(stdin);
    while (1)

    {
    printf("Enter 0 if you do not want bold text.\n");
    printf("Enter 1 to if you do want bold text.\n");
    printf(">-->> ");
    scanf("%d",&in_response);

    /* if user inputs 1 continue to utility if the
    user enters 0 exit the program */

    if (in_response == 1) &txtinput.bold;
    if (in_response == 0) exit(0);
    }

    fflush(stdin);
    while (1)
    {
    printf("Enter 0 if you do not want italics text.\n");
    printf("Enter 1 to if you do want italics text.\n");
    printf(">-->> ");
    scanf("%d",&in_response);

    /* if user inputs 1 continue to utility if the
    user enters 0 exit the program */

    if (in_response == 1) &txtinput.italics;
    if (in_response == 0) exit(0);
    }

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    > fflush(stdin);

    This is undefined and depending on your compiler, won't work, or will work incorrectly.

    > if (in_response == 1) &txtinput.bold;

    What is this supposed to do? Is this a function pointer? Either way, why are you trying to produce it's address? The '&' symbol does one of two things:

    1) applies a bitwise AND
    2) produces the address of the variable it's used with

    In either case, your if section here does nothing benificial, or correct for that matter.

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User mattz's Avatar
    Join Date
    Nov 2001
    Posts
    52
    I need to rethink this one again. Apparently I am way off base at this point.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. (Multiline) Edit Control Limit
    By P4R4N01D in forum Windows Programming
    Replies: 9
    Last Post: 05-17-2008, 11:56 AM
  2. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  3. very weird .h problem
    By royuco77 in forum C++ Programming
    Replies: 1
    Last Post: 09-11-2005, 07:55 AM
  4. Edit Control problem
    By Malek in forum Windows Programming
    Replies: 3
    Last Post: 06-16-2002, 01:12 AM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM