C Board  

Go Back   C Board > General Programming Boards > C Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 09-26-2008, 11:28 PM   #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?
scarlet00014 is offline   Reply With Quote
Old 09-27-2008, 01:16 AM   #2
and the hat of vanishing
 
Salem's Avatar
 
Join Date: Aug 2001
Location: The edge of the known universe
Posts: 21,214
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.
Up to 8Mb PlusNet broadband from only £5.99 a month!
Salem is offline   Reply With Quote
Reply

Tags
array, arrays, beginner, stdin

Thread Tools
Display Modes

Forum Jump

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


All times are GMT -6. The time now is 01:38 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

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