(Link to AcmlmWiki) Offline: thank ||bass
Register | Login
Views: 13,040,846
Main | Memberlist | Active users | Calendar | Chat | Online users
Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album
06-29-24 05:42 AM
0 users currently in Programming.
Acmlm's Board - I3 Archive - Programming - Ok I want to build a code editor but...
  
User name:
Password:
Reply:
 
Options: - -
Quik-Attach:
Preview for more options

Max size 1.00 MB, types: png, gif, jpg, txt, zip, rar, tar, gz, 7z, ace, mp3, ogg, mid, ips, bz2, lzh, psd

UserPost
Black Lord +
Posts: 223/273
Originally posted by rubixcuber

//I assume you want to print the next line. If PHP I think you need echo or some equivalent function
<"txta=text ROWS=100 COLS=100">$content<""/TEXTAREA"">



Or he could close the php script, put the next line, and then open it back up via

?>
<txta=text ROWS=100 COLS=100> $content </TEXTAREA>
<?
darkwitch
Posts: 74/214
Ok, thanks

Im going to test it right away.

And yes, I was talking about PHP .
rubixcuber
Posts: 345/356
Well, you didn't say but I'm going to assume PHP because of the $ prefix on variables and the ?>. If it's not PHP, most of it should still apply though.

First of all, fopen requires a second argument. You need to specify the mode you want to open the file in.

Second, you have to tell fread how much data to read in. There are a couple ways to do this. You can check the file size and have fread read in that much data, or do a loop checking for the end of file and reading data if not at the end of the file yet.

Third... this is the part that makes me wonder what language this is. In PHP fput is called fputs. And you pass the text as an argument. So this would be the way in PHP:

fputs($file,$text);

Also you need to close the file. Call fclose($file) when you are done using it.

Here's my revised code:

$file = fopen($filename ,'r'); //open file for reading
$content = "";
while(!feof($file)){ //while not at end of file
$content.=fread($file,1); //read one byte of the file
}
fclose($file); //close the file
//I assume you want to print the next line. If PHP I think you need echo or some equivalent function
<"txta=text ROWS=100 COLS=100">$content<""/TEXTAREA"">
$inph=action VALUE=savefile>
$inps=submit VALUE=\"Save File\"><""/TD"">

if($action=blaablablabla){
fopen($file,'w');//open file for writing (this will erase the file is you want to append use a instead of w)
fputs($file,$text); //write to file
fclose($file); //close the file
print" blabalablabal";
?>

Hope that helps a bit.
darkwitch
Posts: 67/214
Thanks Kailieann Now I know a way to post codes properly

But I still am confused with the codes I mentioned earlier
Kailieann
Posts: 519/808
With regards to the quotes..

&#60; = <
&#62; = >
darkwitch
Posts: 50/214
Im not too good in ( fopen() fclose() fread() fwhatever() )

So anybody care to explain a little in deep how those work?
Will this work:
require blablabla;

$file = fopen($filename);
$content = fread($file);
<"txta=text ROWS=100 COLS=100">$content<""/TEXTAREA"">
$inph=action VALUE=savefile>
$inps=submit VALUE=\"Save File\"><""/TD"">

if($action=blaablablabla){
fput($file) = $text;
print" blabalablabal";
?>

Please ignore the quotes, not adding them would do ugly things.
Will that crap work (most likely not).I just want to know where I have errors to learn from my mistakes
Acmlm's Board - I3 Archive - Programming - Ok I want to build a code editor but...


ABII

Acmlmboard 1.92.999, 9/17/2006
©2000-2006 Acmlm, Emuz, Blades, Xkeeper

Page rendered in 0.010 seconds; used 351.02 kB (max 393.67 kB)