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...
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...
5
Solved
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 ...
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.... ...
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...
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(...
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 ...
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...
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 ...
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...
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 ...
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...
© 2022 - 2024 — McMap. All rights reserved.