![]() |
Register | Login | |||||
![]() |
Main
| Memberlist
| Active users
| Calendar
| Chat
| Online users Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album |
![]()
| |
0 users currently in Programming. |
Acmlm's Board - I3 Archive - Programming - Ok I want to build a code editor but... |
New poll | ![]() ![]() |
Add to favorites | Next newer thread | Next older thread |
User | Post | ||
darkwitch![]() Red Cheep-cheep ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Since: 10-16-06 From: Puerto Rico Last post: 6342 days Last view: 6342 days |
| ||
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 ![]() |
|||
Kailieann![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Since: 11-18-05 Last post: 6342 days Last view: 6342 days |
| ||
With regards to the quotes..
< = < > = > |
|||
darkwitch![]() Red Cheep-cheep ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Since: 10-16-06 From: Puerto Rico Last post: 6342 days Last view: 6342 days |
| ||
Thanks Kailieann Now I know a way to post codes properly
But I still am confused with the codes I mentioned earlier |
|||
rubixcuber![]() Mole ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Since: 09-08-06 From: St. Louis, MO Last post: 6451 days Last view: 6451 days |
| ||
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![]() Red Cheep-cheep ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Since: 10-16-06 From: Puerto Rico Last post: 6342 days Last view: 6342 days |
| ||
Ok, thanks ![]() Im going to test it right away. And yes, I was talking about PHP ![]() |
|||
Black Lord +![]() Flurry ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Since: 11-17-05 From: Where indians still roam... Last post: 6344 days Last view: 6345 days |
| ||
Originally posted by rubixcuber 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> <? (edited by Black Lord + on 11-10-06 06:22 PM) (edited by Black Lord + on 11-10-06 06:23 PM) (edited by Black Lord + on 11-10-06 06:24 PM) |
Add to favorites | Next newer thread | Next older thread |
Acmlm's Board - I3 Archive - Programming - Ok I want to build a code editor but... |
![]() ![]() |