I have got a website with a few friends from school(year8). We have got a website up. I want it so it looks for a textfile and reads and writes it into a textbox. It does do this. The only problem is that it doesn't read the whole file. It may read like 3 words out of 7 so its not that gud.
This is my code -
<div id="text2" style="position:absolute; overflow:hidden; left:351px; top:192px; width:475px; height:671px; z-index:2"><div class="wpmd">
-
<div><font class="ws12" face="Franklin Gothic Heavy">
-
<?php
-
$myFile = "HomeNews.txt";
-
$passw = fopen($myFile, "r");
-
$pass = fread($passw, 5);
-
while ( $line = fgets($passw, 1000) ) {
-
echo($line);
-
}
I am using notepad on windows xp. And im using my friends server which he pays for and i think they use appach.
Hopefully someone can help.
Thanks alot
Mague
4 1848 nathj 938
Recognized Expert Contributor
[php]
<div id="text2" style="position :absolute; overflow:hidden ; left:351px; top:192px; width:475px; height:671px; z-index:2"><div class="wpmd">
<div><font class="ws12" face="Franklin Gothic Heavy">
<?php
$myFile = "HomeNews.t xt";
$passw = fopen($myFile, "r");
$pass = fread($passw, 5);
while ( $line = fgets($passw, 1000) ) {
echo($line);
}
[/php]
Mague
Try changing the line:
[php]
$pass = fread($passw, 5) ;
[/php]
To:
[php]
$pass = fread($passw, filesize($passw ))
[/php]
I found this on the php site. There maybe more helpful information there.
Cheers
nathj
Try changing the line:
[php]
$pass = fread($passw, 5) ;
[/php]
To:
[php]
$pass = fread($passw, filesize($passw ))
[/php]
I found this on the php site. There maybe more helpful information there.
Cheers
nathj
Thanks Alot this code didn't work but led me on to find this code
$contents = fread($handle,f ilesize); which does work
thanks heaps
Mague
nathj 938
Recognized Expert Contributor
Thanks Alot this code didn't work but led me on to find this code
$contents = fread($handle,f ilesize); which does work
thanks heaps
Mague
that;s my mistake - the filesize function takes the filename as the parameter not the file handle - that's my fault. Sorry, at least it's working now though.
All the best with the rest of the project.
Cheers
nathj
pbmods 5,821
Recognized Expert Expert
Heya, Mague.
Please use CODE tags when posting source code. See the REPLY GUIDELINES on the right side of the page next time you post.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: ranjeet |
last post by:
Hay Guys can you all suggest me the points on the below issue
Problem :
The thing is that I have the data some thing like this.
1486, 2168, 3751, 9074, 12134, 13944, 17983, 19173, 21190, 21820,
1730, 2640, 3450, 4870, 6126, 7876, 15644, 17817, 20294, 21902,
2070, 3025, 4333, 5854, 7805, 9231, 10597,
16047........................... soo onnnnnn
|
by: Kueishiong Tu |
last post by:
I have a text file with wide characters. I use the following C++ code to read
them in. However the wide characters are not read in properly. What is wrong?
String* path = "C:\\Documents and Settings\\kst\\BE.dat";
try
{
FileStream* fs = new FileStream(path, FileMode::Open);
StreamReader* sr = new StreamReader(fs);
|
by: Jerry |
last post by:
Below is ALL the code for all the databases...
Here's the problem:
I callup the aspx file in IE and the form comes up just fine. When I
select a person to update, I get the subject error. Aparently, when I
select a person, it's not selecting anyone and returning this error.
Here's the full error:
Description: An unhandled exception occurred during the execution of the
|
by: Ernesto |
last post by:
I'm just want to read in the contents of a (text) file. The text file
is filled with semiColon delimited floating point strings...
0.456;1.265;99.742;...
For some reason, I can't get the contents back when I call file.read()
Here's my code.
filePath = "C:\\folder\\myFile.txt
fileHandle = open(filePath, 'r').read();
|
by: sweetpotatop |
last post by:
Hello,
I have a txt file which has a few lines of special characters:
This is A line from the text file:
٦-ŧُʍѥޘ²ů'ۣб'с ',,طꎏЏ
When I use
sr.ReadLine (where "sr As StreamReader"), it is not giving me this line
| |
by: Thomas Kowalski |
last post by:
Hi,
currently I am reading a huge (about 10-100 MB) text-file line by line
using
fstreams and getline. I wonder whether there is a faster way to read a
file line by line (with std::string line). Is there some way to burst
read the whole file and later "extract" each line?
Thanks in advance,
Thomas Kowalski
|
by: RyanS09 |
last post by:
Hi-
I have read many posts with specific applications of reading in text
files into arrays, however I have not been able to successfully modify
any for my application. I want to take a text file filled with a tab
delimited list of 10 columns (floats) and read it into a 2D array.
The length of the columns are all the same, however this will be
variable from text file to text file. Any help (starter code or where
to read) would be much...
|
by: arnuld |
last post by:
This works fine, I welcome any views/advices/coding-practices :)
/* C++ Primer - 4/e
*
* Exercise 8.9
* STATEMENT:
* write a program to store each line from a file into a
* vector<string>. Now, use istringstream to read read each line
* from the vector a word at a time.
|
by: VK |
last post by:
On Apr 21, 1:54 pm, joe <m...@invalid.comwrote:
http://www.jibbering.com/faq/index.html#FAQ4_18
|
by: Matrixinline |
last post by:
Hi All,
File Text.txt
Contains following text as :
"C:\program file\application data\details\app" "D:\Program File"
I tried to read that data as
fscanf(oFp, "%s %s", sCopyDirectory, sToDirectory);
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |