473,386 Members | 1,647 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

on the bleeding edge, not sure I belong there...stream_get_line()

I have urgent need of the function stream_get_line:
http://www.php.net/manual/en/functio...m-get-line.php
which as you can see is only P5 and above. So I went and got the PHP5
source, hoping to find this function and copy it into my script.

found php_streams.h
don't really know what to do with it...I'm learning a little bit of C but
not enough, I suspect.

Is this a fool's hope? Is there an existing (4.3) function that can be
tweaked to do the same job?

If you're still with me, here's why I need it:

I use .csv files in an import script, and one of the fields in these files
has a lot of new line characters. In fact, the "field" is really an entire
page of html. The .csv looks kinda like this:

"spykids.jpg";"na.jpg";"noQvalue";"0.45";"Spy Kids";"<big><b>This is a
previously-viewed DVD in the original case. Both the DVD and case are in
excellent condition and come with a life-time guarantee. </big></b><br><br>

<b>The Original One!</B><br>
(2002) Color - 88 Minutes
<br><BR>

....and so on

So the usual fgetcsv() doesn't work -- it interprets each new-line as a new
record (even though it's enclosed within double quotes). My thought is that
using stream_get_line with the double-quote defined as the ending would be
the way to override this behavior.
Jul 17 '05 #1
2 1859
"Matthew Crouch" <ma************@spamlessverizon.net> wrote:
"spykids.jpg";"na.jpg";"noQvalue";"0.45";"Spy Kids";"<big><b>This is a
previously-viewed DVD in the original case. Both the DVD and case are
in excellent condition and come with a life-time guarantee.
</big></b><br><br>

<b>The Original One!</B><br>
(2002) Color - 88 Minutes
<br><BR>

...and so on

So the usual fgetcsv() doesn't work -- it interprets each new-line as
a new record (even though it's enclosed within double quotes).


It works fine on my system (PHP 4.3.2 on Linux):
fgetcsv($FP, 2048, ";", "\"");

JOn
Jul 17 '05 #2

"Jon Kraft" <jo*@jonux.co.uk> wrote in message
news:Xn**************************@130.133.1.4...
"Matthew Crouch" <ma************@spamlessverizon.net> wrote:
"spykids.jpg";"na.jpg";"noQvalue";"0.45";"Spy Kids";"<big><b>This is a
previously-viewed DVD in the original case. Both the DVD and case are
in excellent condition and come with a life-time guarantee.
</big></b><br><br>

<b>The Original One!</B><br>
(2002) Color - 88 Minutes
<br><BR>

...and so on

So the usual fgetcsv() doesn't work -- it interprets each new-line as
a new record (even though it's enclosed within double quotes).


It works fine on my system (PHP 4.3.2 on Linux):
fgetcsv($FP, 2048, ";", "\"");

JOn


Very true, thank you. I wasn't using the optional delimiters. Time for
another pot of coffee, I guess.
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: James A. Donald | last post by:
in a web page http://jim.com/econ/chap01p1.html I want the first link, pointing to the previous page in the presentation to line up with left hand edge of the page, and the last link,...
0
by: Ferdi Smit | last post by:
I wrote a generic algorithm for boost.graph to merge two vertices, ie. the end-points of an edge are joined together as if they are a single vertex. I'm currently doing this by creating a new...
2
by: copyco | last post by:
Does anyone have any suggestions on this? I have a form that can be collapsed into a compact size and expanded back to full size. If the user moves the compact size of the form close to the edge,...
3
by: wavedave | last post by:
Hello everyone - I'm trying to build a .NET application (C#) in which my program acts as an add-on to another existing application, providing some additional functionality. The way I want the UI...
3
by: Oliver Block | last post by:
Hello, CSS21 Spec points the following out (9.4.1): <citation> In a block formatting context, each box's left outer edge touches the left edge of the containing block (for right-to-left...
2
by: a | last post by:
where could i find an edge detection example in C#
2
by: as | last post by:
Hi folks, am a newbie in C++ world. Normally I use matlab more often. But right now I want to create a Rising Edge D Flip-Flop model which has two Digital inputs, i.e. INPUTDATA and a CLOCK. The...
0
by: darrenhello | last post by:
hi there, I am doing my last year's project and I have a 'little' problem. I have to do an edge detection filter. for now, some normal edge detection filters that I used worked fine but there a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.