fgets Questions

3

Solved

I am attempting to make a gallery that calls the image names from a flat file database using the PHP 'fgets' function. There are different sections in the gallery, each with it's own default image,...
Triage asked 19/9, 2011 at 22:56

5

I want to read from a stdin stream. Is there any difference in using read() or fgets() to read from the stdin stream. I am attaching the following two pieces of code with fgets and read. With fge...
Almedaalmeeta asked 2/6, 2011 at 20:35

5

Solved

I am parsing emails with Zend_Mail, and strangely some content gets truncated without an obvious reason and malforms the email parts. For example Content-Disposition: attachment; filename="file.s...
Erlineerlinna asked 16/3, 2011 at 7:27

5

Solved

I need to read a line of text (terminated by a newline) without making assumptions about the length. So I now face to possibilities: Use fgets and check each time if the last character is a newli...
Uretic asked 3/3, 2011 at 20:58

1

Solved

I have the following code: int get_int(void) { char input[10]; fgets(input, 10, stdin); // Segfault here return atoi(input); } It gives me a segfault where marked. I have absolutely no idea w...
Spiniferous asked 28/2, 2011 at 0:57

2

Is there a getline function that uses fread (block I/O) instead of fgetc (character I/O)? There's a performance penalty to reading a file character by character via fgetc. We think that to improve ...
Obstruent asked 10/12, 2010 at 17:0

3

Solved

I have a text file with three fields separated by comma. Example of the content of my text file: 12345, true programming newbie, BS ME To load the file into the program, i used the below code.... ...
Shumway asked 2/12, 2010 at 13:44

5

Solved

struct DVDInfo *ReadStruct( void ) { struct DVDInfo *infoPtr; int num; char line[ kMaxLineLength ]; char *result; infoPtr = malloc( sizeof( struct DVDInfo ) ); if ( NULL == infoPtr ) { pri...
Forecourse asked 13/10, 2010 at 18:54

2

Solved

it seems as if fgets puts a space after everything it returns. Here's some example code: <?php Echo "Opening " . $_SERVER{'DOCUMENT_ROOT'} . "/file.txt" . "...<br>"; $FileHandle = @Fopen(...
Bobbery asked 18/8, 2010 at 14:33

5

Solved

I'm trying to write a piece of code that reads a file line by line and stores each line, up to a certain amount of input data. I want to guard against the end-user being evil and putting something ...
Maim asked 28/5, 2010 at 15:50

4

Solved

I need to read a file and send the text from it to a string so I can parse it. However, the program won't know exactly how long the file is, so what would I do if I wanted to use fgets(), or is the...
Epinephrine asked 21/5, 2010 at 4:21

1

So I have a file stream from a parent process to a child - and most of the time it works fine. However, when reading from it multiple times quickly, using fgets() will return NULL and the error is ...
Edlyn asked 5/5, 2010 at 2:18

2

I'm having some real problems with the lag produced by using fgets to grab the server's response to some batch database calls I'm making. I'm sending through a batch of say, 10,000 calls and I've...
Amberlyamberoid asked 19/4, 2010 at 20:48

4

I know everybody has told me to use fgets and not gets because of buffer overflow. However, I am a bit confused about the third parameter in fgets(). As I understand it, fgets is dependent on: cha...
Eloiseloisa asked 4/1, 2010 at 19:34

7

Solved

I have a text file with up to 100 IP addresses, 1 per line. I need to read each address, as a string, into an array called "list". First, I'm assuming that "list" will need to be a two-dimensional ...
Photoelectron asked 3/12, 2009 at 19:42

7

Solved

I'm writing a program where performance is quite important, but not critical. Currently I am reading in text from a FILE* line by line and I use fgets to obtain each line. After using some performa...
Friedrich asked 9/4, 2009 at 1:24

5

I have a popen() function which executes tail -f sometextfile. Aslong as there is data in the filestream obviously I can get the data through fgets(). Now, if no new data comes from tail, fgets() h...
Kp asked 29/9, 2008 at 17:51

© 2022 - 2024 — McMap. All rights reserved.