reading data from the users input

This is a discussion on reading data from the users input within the C++ Programming forums, part of the General Programming Boards category; First off, please excuse the fact that there is some syntax of C in here...(i'm trying something) I'm trying to ...

  1. #1
    Registered User
    Join Date
    Sep 2003
    Posts
    49

    reading data from the users input

    First off, please excuse the fact that there is some syntax of C in here...(i'm trying something)

    I'm trying to read a line of data, that the user enters, and then store it into a linked list...

    it will not continue past this...

    Code:
    struct link_list
       {
        char info;
           struct link_list *next;
           struct link_list *pre;
    .....
    Code:
    	    printf("\nENTER INFO:");
    	    scanf("%s", list->info);
    thanks
    Code this

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    From the very limited amount of code you've shown, I'll take a stab. You are trying to store a string in the info variable in the link_list structure. You are only declaring a single character though. You need to make this an array or a string. Also, if you use an array, then you had better use fgets to retrieve the input from the user and not scanf.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 13
    Last Post: 04-05-2009, 11:16 AM
  2. Replies: 7
    Last Post: 02-02-2009, 07:27 AM
  3. xor linked list
    By adramalech in forum C Programming
    Replies: 23
    Last Post: 10-14-2008, 11:13 AM
  4. need help?? ...reading input data
    By smd in forum C++ Programming
    Replies: 0
    Last Post: 07-17-2002, 07:44 AM

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