Omgili - forum search, search forums  
  

Discussions about fscanf stdin

Displaying 1 - 10 out of 83 discussions.  
Time Frame: (Any time)   Minimum number of replies: (2)   Minimum number of discussing users: (0)
  |  

Page: 1   2   3   4   5   6   7   8   9  
Keep this page open to be updated with the newest discussions automatically.
I've already got some code to read a text file using fscanf() , and now I need it modified so that fields that were previously whitespace-free need to allow whitespace. The text file is basically in the form of: title: DATA title: DATA etc... which is...
Started by on , 7 posts by 7 people.  
Fgets() use the %[ conversion specifier (with the "exclude option"): char buf[100]; fscanf(stdin, "%*sI highly suggest you stop using fscanf() and start using fgets() (which reads a whole line to parsing non-exactly-formatted input....
I'm looking to write a pair of utilities that read in a newline separated list of integers on stdin and output their binary (4 byte) equivalent to stdout, and vice versa. My first thought was a simple bash/linux command that would do this, but I was unable...
Started by on , 4 posts by 4 people.  
Beware of endianness the stdin....
:) #include <stdio.h> int main () { int x; while (fscanf(stdin, "%i", &x)) { fwrite(&x, sizeof(x), 1 of fscanf() to read each integer, followed by a fwrite() to write it out should work.
On Fri, 16 Jan 2009 00:48:57 +0000 (UTC), Vincent Lefevre <vincent+news@vinc17.org I posted the following message to the Austin Group mailing-list about (IMHO) a contradiction between POSIX.1-2008 and the ISO C standard. I haven't had any answer...
Started by on , 3 posts by 2 people.  
Answer Snippets (Read the full thread at omgili):
But if you write a test program you'll find that glibc fscanf() returns 1 for an input failure enough data in it for one conversion, so that fscanf() gets an EAGAIN error when it tries to read.
Ask your Facebook Friends
Note: I completely reworked the question to more properly reflect what I am setting the bounty for. Please excuse any inconsistencies with already-given answers this might have created. I did not want to create a new question, as previous answers to this...
Started by on , 9 posts by 7 people.  
Maybe just set the stream's error indicator? I am", &x); ungetc('9', stdin); scanf("%d", &y); printf("%d, %d\n", x, y); If the input is "100 of PL22.11 (ANSI "C"), on comp.std.c shed some light....
What fscanf() should do if ungetc() fails.
Dear all,, I want to read line-by-line from a given input file,, process each line (i.e. its words) and then move on to other line... So i am using fscanf(fptr,"%s",words) to read the word and it should stop once it encounters end of line... but this ...
Started by on , 5 posts by 5 people.  
*/ int n = fscanf(stdin, "%" xstr(MAXLINE) "[^\n = fscanf(stdin, "%" xstr(MAXLINE) "[^\n]%*[^\n]", line); if (!feof(stdin)) { getchar(); } } return 0 is running in line....
Discard the rest upto and including a newline.
I have to make a user input num/percentage pairs. the code looks like: while(choice != 0) { printf("enter number"); fgets(line, sizeof(line), stdin);//sizeof(line) is 6 sscanf(line, "%d\n", choice); if(choice > 0) { printf("enter percentage\n"); fgets...
Started by on , 4 posts by 4 people.  
Choice != 0) { printf("enter number"); fscanf(stdin, "%d", &choice); if(choice > 0) { printf("enter percentage\n"); fscanf(stdin, "%f", &percentage); //add to an array holding numbers vs percentagesThis isn't necessarily....
I'd like to scan a variables that form vectors from white space delimited text file and the stumbling block (all to often for me) is lack of elegance. Currently my scanning code requires delineating the size of the vector as the first element in the file...
Started by on , 5 posts by 5 people.  
Int scan_vector(FILE *fh) { char pad[2]; int i; if (fscanf(fh,"%d %1[:]", &v.Length, &pad) != 2; i++) { if (fscanf(fh, "%lf", &v.value[i]) != 1) return -1; } return 0; } This attempts to read the vector with scanf_vector(stdin, ....
I need the MD5 sums of 3 million strings or so in a bash script on ubuntu. 3 million strings -> 3 million MD5 hashes. The trivial implementation takes about 0.005sec per string. That's over 4 hours. What faster alternatives exist? Is there a way to...
Started by on , 6 posts by 6 people.  
Fopen" ); return( 1 ); } while( fscanf(f, "%s", buf) == 1 ) { md5_starts( &ctx ); md5_update( &ctx, buf.
Saludos a todos. Llevo ya varias semanas intentando encontrar el error pero no doy con el, ya he intentado con muchas cosas pero nada. Tengo una función que agrega (o al menos, debería agregar) productos a una "base de datos" en .txt, y cual es parte ...
Started by on , 3 posts by 2 people.  
Precio ) { int i = 0 ; int j = 0 ; rewind ( fp1 ) ; fscanf ( fp1 , "%s" , nuevo_producto_nombre ) ; while ( ! feof ( fp1 ) ) { fscanf ( fp1 , "%s" , nuevo_producto_nombre ) ; i++; } rewind ( fp2 ) ; fscanf ( fp2 , "%f" ,& ( * nuevo....
How to compare a pointer an integer in C? will not let me do while(pt != '*') in line 76 #include <stdio.h> #include <strings.h> #include <stdlib.h> #define SIZE 30 #define PEOPLE_SIZE 20 #define PRINT_NETWORK 1 struct people //structure...
Started by on , 1 posts by 1 people.  
Answer Snippets (Read the full thread at yahoo):
Page: 1   2   3   4   5   6   7   8   9  

Related Message Boards & Forums

  • Stack Overflow
  • Answer | Open Programming & Design Questions – Yahoo! Answers
  • C/C++ - Foros del Web
More Information


Forum Search About Omgili Help Plugins Forum/Board Owners Privacy

i
In Title
In Topic
In Reply
Exclude
Boost