Tag Info

New answers tagged

0

grep -v '[^0-9]' <infile |./cprogram That would only print empty lines or lines containing only numbers at your program. You could also edit each line... sed 's/[^0-9]//g' <infile |./cprogram You can filter empties... sed -n 's/[^0-9]//g;/./p' <infile |./cprogram Or you might want to include . and/or sign: sed -n 's/[^- .0-9]//g ...


1

You seem to have come pretty close to something that should work.  I would modify it to: while IFS= read -r l; do printf "%s\n" "$l" | ./c_program; done < test_numbers.txt Say read l rather than read $l. Use read -r to read "raw" lines (don't interpret backslashes). Use IFS= to capture leading and trailing spaces. Don't say printf "$l"; that will ...


0

Your have to write an script, which contains expect ,sudo and make install to solve your problem and your system() function call your script such as : system("myscrip.sh"); For reading expect : How to login as root from Bash and do stuff


0

awk {'print $1'} test_numbers.txt |./c_program


2

fopen is a library function, and it returns a FILE data structure. (Simplified) details about this structure may be found on this page. Among the members of this structure is a char called fd, labelled as the file descriptor. Every time a process opens a file using the open system call (which is what fopen does), an entry is created in a kernel internal ...


3

From the Select manpage: On Linux, select() modifies timeout to reflect the amount of time not slept; most other implementations do not do this. (POSIX.1-2001 permits either behavior.) After the first timeout occurs, your timeout variable has been updated to reflect the amount of time remaining to sleep, which is 0, because it waited for the entire ...



Top 50 recent answers are included