Array with input? please help..beginner

This is a discussion on Array with input? please help..beginner within the C Programming forums, part of the General Programming Boards category; I have std input thats says @ 3 4 This means that I need to put an @ sign at ...

  1. #1
    Registered User
    Join Date
    Sep 2008
    Posts
    58

    Array with input? please help..beginner

    I have std input thats says

    @ 3 4

    This means that I need to put an @ sign at slot 3 in my array, and slot 4. how do I do this using getline? im using ./exe <input as my command line argument, so my file 'input' looks like this

    @ 3 4
    % 5 12
    # 2 17

    so obviously i have a 2 dimensional array.. so.. array[i][j] = @ if i = 0 and j = 3.. right?
    how do i put this in a loop?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,851
    Code:
    char buff[BUFSIZ];
    while ( fgets( buff, sizeof buff, stdin ) != NULL ) {
    }
    Reads from the keyboard, or from the file if you use <input on the command line.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. can someone help me with these errors please code included
    By geekrockergal in forum C Programming
    Replies: 7
    Last Post: 02-10-2009, 02:20 PM
  2. beginner here need help with an array code
    By Ohshtdude in forum C++ Programming
    Replies: 6
    Last Post: 02-01-2009, 05:42 PM
  3. entering numbers to array in a row whithout length input
    By transgalactic2 in forum C Programming
    Replies: 55
    Last Post: 01-02-2009, 04:02 AM
  4. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 10:54 AM

Tags for this Thread


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