Questions tagged [ungetc]

22 questions
0
votes
1 answer

wrap ungetc() without puts() gets() and streams in general

I'm porting net-snmp to an embedded platform that only has limited access to the filesystem and I stumbled upon a big problem. There's a part of the core code that uses the ungetc() function, which I don't have. There are of course 2 solutions: A)…
mfloris
  • 361
  • 4
  • 16
0
votes
1 answer

Function like ungetc in php

is there a function in php which does something similar to ungetc C? I mean a function that puts a character back onto a stream?
sykatch
  • 301
  • 1
  • 2
  • 13
0
votes
1 answer

fefo is not checking EOF during its last iteration in while loop?

I have a code which uses ungetc,and fefo function but i noticed that fefo is not checking for EOF below is my code #include int main () { FILE *fp; int c; char buffer [200]; fp = fopen("", "r"); if( fp == NULL ) { …
user4950013
  • 137
  • 5
0
votes
2 answers

Undoing the effects of ungetc() : "How" do fseek(),rewind() and fsetpos() do it?Is buffer refilled each time?

Huh!!How shall I put the whole thing in a clear question!!Let me try: I know that the files opened using fopen() are buffered into memory.We use a buffer for efficiency and ease.During a read from the file, the contents of the file are first read to…
Thokchom
  • 1,602
  • 3
  • 17
  • 32
0
votes
3 answers

understanding ungetc use in a simple getword

I've come across such an example of getword. I understand all the checks and etc. but I have a problem with ungetc. When the c does satisfy if ((!isalpha(c)) || c == EOF)and also doesn't satisfy while (isalnum(c)) -> it isn't a letter, nor a…
Peter Cerba
  • 806
  • 4
  • 14
  • 26
0
votes
1 answer

Equivalents for these functions in SolFS?

I am making an extension for an application. My extension uses SolFS and I want to use it to redirect all file traffic to SolFS. To accomplish this I need a bit of help because SolFS has not the equivalents for all needed functions (3 to be…
user1182183
-3
votes
4 answers

Why the input "abc!!!" but the output is not "abc+++"?

I researching about input/output file.Below code relate some functions such as: fgetc(),fgets(),fputs(). i don't know why it does not work exactly as i want.Thank you so much ! Below is my code: #include int main() { FILE *fp; //FILE…
1
2