Hi, I was trying the following code from a SAMS book. It is supposed to write some output to the purchase.txt file after formatting it through the column application . the file gets created but nothing gets written to it for some reason. Can someone please explain? - <?php
-
$products = array(
-
array("HAL 2000", 2, "red"),
-
array("Tricorder", 3, "blue"),
-
array("ORAC AI", 1, "pick"),
-
array("Sonic Screwdriver", 1, "orange")
-
);
-
$handle = popen("column -tc 3 -s / > purchase.txt", "w");
-
foreach ($products as $p){
-
//fputs($handle, join('/', $p). "\n");
-
}
-
-
pclose($handle);
-
echo "done";
-
?>
3 1142 Atli 5,058
Recognized Expert Expert
Hey.
Have you tried un-commenting line #10?
If yes, try turning on the Debug Messages and see if an error is being suppressed.
Oh sorry, that was just a slip, in the real code that line is not commented. Please help...
Atli 5,058
Recognized Expert Expert
Ok.
I'm guessing this is a permission problem. The popen command can not tell whether the column command is actually able to write to the output file, so even if there is a permission problem, odds are that you will see no error.
Try using the is_writable function on the file before trying to write to it, to make sure you have access. If it turns out you don't have access to it, you can try to use the chmod command to alter the access, or log in via FTP (or whatever you use) and change it manually.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Oliver Knoll |
last post by:
According to my ANSI book, tmpfile() creates a file with wb+ mode
(that is just writing, right?). How would one reopen it for reading?
I got the following (which works):
FILE *tmpFile =...
|
by: Colin JN Breame |
last post by:
Hi,
Fairly new to C. What is the best way to read a line (\n terminated) from
a file? Ive looked at fscanf but was not sure which format specifier to
use. (%s perhaps).
Thanks
Colin
|
by: ruca |
last post by:
Hi,
Can I read a .TXT File to a DataSet? How can I do that?
I want to read his lines to a DropDownList. This lines are the names of
employees that I export from an application that I have.
I...
|
by: crusell |
last post by:
I'm having some problem with my Visual Studio.NET 2003 (.NET 1.1 SP1)
install. I am unable to use the web forms designer with any aspx file
whose
form class inherits from a base class. I'm...
|
by: Sameer |
last post by:
Hi,
when i compile my C programs (even 2 line progs) give the warning, no
new line at end of file.
What does this mean ?
-Regards,
Sameer
| |
by: john_aspinall |
last post by:
Here's the overview:
Im building an eCommerce web site using ASP. It has an Access DB at
the back end. Im receiving the Product info from a series of CSV
files. Ive created a Table in Access...
|
by: DH |
last post by:
Hi,
I'm trying to strip the html and other useless junk from a html page..
Id like to create something like an automated text editor, where it
takes the keywords from a txt file and removes them...
|
by: emailseshu |
last post by:
Hi,
Iam trying to check the Client Side CallBack Feature in ASP.NET
Iam able to call th RaiseCallbackEvent from the Client Side Javascript
Function but when I go to the debug mode to check the...
|
by: Rene |
last post by:
Hello to all!
I am a newbee to C++, I did a beginners' course, and now I am stuck with a
strange problem.
I have written the function that is pasted downwards. The peculiar thing is
that when...
|
by: Andrew Jocelyn |
last post by:
Hi
I'm running an ASP.NET web application under IIS. I'm inserting a cache
object with a file based CacheDependency. I've noticed that when the file
changes the Cache object is not always...
|
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,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |