Menu
Menu
DaniWeb
Log In
Sign Up
Read
Contribute
Meet
Search
Search
About 123 results for
filewrite
- Page 1
Need help on FileWrite function.
Programming
Software Development
20 Years Ago
by Buchas
…(FileName, fmOpenWrite);} else { FileHandle = FileCreate(FileName);}
FileWrite
(FileHandle, FileInput, strlen("Simple text")); //write…FileName, fmOpenWrite);} else { FileHandle = FileCreate(FileName);}
FileWrite
(FileHandle, FileInput, sizeof(Label1->Caption)); //write smth…
Filewrite
Programming
Software Development
17 Years Ago
by durai1117
Hi friends i have one doubt i want to write some error messages in a file,but the situation is i dont know the filename. That is my task is to write in a file , but the name of the file is not known, i have to get that file name in runtime , that will be assigned during the constructor call, and some time that file name was wrong path , i…
Re: Filewrite
Programming
Software Development
17 Years Ago
by Ramy Mahrous
what are you saying :| I think that's some sort of impossible tasks!!! at least you should know the exact path, files reside down.
Filewrite to specific lines (Long not String)
Programming
Software Development
13 Years Ago
by 03hasnam
[B]Hello Guys, Hope youre all well :) Please can someone kindly tell me how I can write to a specific line. The value to be written needs to be in long and not as a string. The File is as follows: 1324214082786 1313131 Paid 0.0 the seconds line is time in miliseconds, i need to replace that to current miliseconds using filewriter. please …
Re: Filewrite to specific lines (Long not String)
Programming
Software Development
13 Years Ago
by stultuske
no can do as far as I know .. just cast your long to a String, and write that. when you read your file, cast the String you write back to a long.
Re: Filewrite to specific lines (Long not String)
Programming
Software Development
13 Years Ago
by NormR1
Is "cast" the right word to use here? Would the more generic term: convert be better? I think of cast as a coding technique: a datatype in parenthesis () before an expression.
Re: Filewrite to specific lines (Long not String)
Programming
Software Development
13 Years Ago
by stultuske
nyes, propably convert is better suited for the situation :)
Re: Filewrite to specific lines (Long not String)
Programming
Software Development
13 Years Ago
by 03hasnam
ok so how about writing to 2nd line only?
Re: Filewrite to specific lines (Long not String)
Programming
Software Development
13 Years Ago
by stultuske
what do you mean, write to second line only?
Re: Filewrite to specific lines (Long not String)
Programming
Software Development
13 Years Ago
by 03hasnam
how to replace the existing data of the 2nd line of the file, how do perform the Fwrite function to write on the second line only keeping others same as they are.
Re: Filewrite to specific lines (Long not String)
Programming
Software Development
13 Years Ago
by hfx642
You can think of it THIS way... BufferedReader and BufferedWriter are to read and write text files (ie strings). Sounds like you want to do ObjectInputStream and ObjectOutputStream to read and write binary files.
Re: Filewrite to specific lines (Long not String)
Programming
Software Development
13 Years Ago
by 03hasnam
could you look at my code and just show me how to write it to 2nd line of file?
Re: Filewrite to specific lines (Long not String)
Programming
Software Development
13 Years Ago
by NormR1
You can not write just the second line easily. You need to read in the whole file, change the second line and write it all out. The bytes in the file are contiguous (right next to each other). You would need the new second line to be exactly the same size as the current line. For example if the file contained: 111111222233334444 If the above is …
Re: Filewrite to specific lines (Long not String)
Programming
Software Development
13 Years Ago
by JamesCherrill
[QUOTE=hfx642;1718333]Sounds like you want to do ObjectInputStream and ObjectOutputStream to read and write binary files.[/QUOTE] I think this is a slip of the keyboard - should be DataInputStream and DataOutputStream ;)
Re: Filewrite to specific lines (Long not String)
Programming
Software Development
13 Years Ago
by hfx642
No... It's NOT a slip of the keyboard. I have been using ObjectInputStream and ObjectOutputStream for years... and it works. But, gee... Now you got me thinking, James. I'm not a Java expert. (Actually... I'm an Oracle expert!) Should I be using DataInputStream and DataOutputStream? If so... Please tell me why?
Re: Filewrite to specific lines (Long not String)
Programming
Software Development
13 Years Ago
by JamesCherrill
OOS writes in a format with info about the Objects you are writing, which is used by OIS when reading them in. DOS and DIS just write the bytes of raw data. Having said that, if you just write primitives and UTF strings then maybe they are the same? I don't know. I've always used OOS/OIS when sending objects from A to B (both Java), and DOS/DIS …
Re: Filewrite to specific lines (Long not String)
Programming
Software Development
13 Years Ago
by hfx642
[I]Anyway, sorry if maligned your keyboard skills unfairly![/I] Ya make me laugh, James... Ya make me laugh!!! If I could write files without object info, that would be great. I'll certainly look into that. It would make it a [B][U]LOT[/U][/B] easier when updating/converting file structures!
Re: Filewrite to specific lines (Long not String)
Programming
Software Development
13 Years Ago
by 03hasnam
I am still experiencing difficulty in replace content of seconds line, would someone be able to give me an example using while loop or something and readline() function?
Re: Filewrite to specific lines (Long not String)
Programming
Software Development
13 Years Ago
by JamesCherrill
There's one key point that's unclear from your posts... what is the format of that second line? Is it a string of ordinary text, representing a number in a human-readable form, or is it a Java long written as an 8-byte binary value that people cannot read?
Re: Filewrite to specific lines (Long not String)
Programming
Software Development
13 Years Ago
by 03hasnam
[QUOTE=JamesCherrill;1718890]There's one key point that's unclear from your posts... what is the format of that second line? Is it a string of ordinary text, representing a number in a human-readable form, or is it a Java long written as an 8-byte binary value that people cannot read?[/QUOTE] sorry for the unclear post, the seconds line is i …
Re: Filewrite to specific lines (Long not String)
Programming
Software Development
13 Years Ago
by JamesCherrill
No. I understand that the data starts out as a long, and eventually needs to be used as a long, but how is it stored in the file? When you look in the file do you see 1313131 or do you see some gibberish binary values?
Re: Filewrite to specific lines (Long not String)
Programming
Software Development
13 Years Ago
by 03hasnam
[QUOTE=JamesCherrill;1718909]No. I understand that the data starts out as a long, and eventually needs to be used as a long, but how is it stored in the file? When you look in the file do you see 1313131 or do you see some gibberish binary values?[/QUOTE] the file content is as follows: [B]1324254875443 1313131 Paid 0.0[/B] 1313131 …
Re: Filewrite to specific lines (Long not String)
Programming
Software Development
13 Years Ago
by JamesCherrill
OK, so it's in text/string format. As you have already been told, you can't just overwrite line 2 in the file. You have to read the file in, update it , and write it back out again. What follows isn't the slickest or most expert way to do that, but it breaks it down into three easy steps for you to code one at a time. 1.1 Create a String array …
Re: Filewrite to specific lines (Long not String)
Programming
Software Development
13 Years Ago
by 03hasnam
[QUOTE=JamesCherrill;1718914]OK, so it's in text/string format. As you have already been told, you can't just overwrite line 2 in the file. You have to read the file in, update it , and write it back out again. What follows isn't the slickest or most expert way to do that, but it breaks it down into three easy steps for you to code one at a …
Re: Filewrite to specific lines (Long not String)
Programming
Software Development
13 Years Ago
by JamesCherrill
I broke that down into steps so small and so simple that I can't really give any more detail without coding it for you. If you're not familiar with arrays yet then create four String variables for line1, line2 etc and use those instead of the array. (In which case you won't use any loops either). In the end you will only learn how to do this by …
Re: Why does "w" not create a file for writting in my code?
Programming
Software Development
12 Years Ago
by deceptikon
… file copy"); fgets(
filewrite
, 40, stdin);
filewrite
[strlen(
filewrite
)-1] = '\0'; file_w = fopen(
filewrite
, "w"); …Filename enter again"); fgets(
filewrite
, 40, stdin);
filewrite
[strlen(
filewrite
)-1] = '\0'; file_r = fopen(
filewrite
, "w"); }…
Python FTP Help
Programming
Software Development
10 Years Ago
by Anthony_7
…;)) file = fileName + fileType cls() fileUsing = open(file, "a")
fileWrite
= "" print ("CMDS: [//Q = Save and Quit] [//SF…
Link-listed addressbook
Programming
Software Development
18 Years Ago
by Shaabangbang
… contact pPtr[]); int isvalidphone (struct contact nPtr[]); void flush_in (); int
filewrite
(); int displaydata (); int loaddata (); int finalsave (); void formatphonenumber (struct …module to search for a saved contact break; case 4:
filewrite
(); // go to the file saving module to save contacts inputted…
Writing to a text file inside a class
Programming
Software Development
15 Years Ago
by bobstein
… setName(self, name): self.__monName = name def
fileWrite
(self): monFile = open('MonsterFile.txt', 'w')…name: ') monStats = MonsterClass.MonsterStats(name) monStats.
fileWrite
() [/code] The prompt comes up as it …MonsterMaker\MonsterClass.py", line 13, in
fileWrite
monFile.write(self.__monName) AttributeError: 'tuple'…
Why does "w" not create a file for writting in my code?
Programming
Software Development
12 Years Ago
by artur.sinelnikovs
…(void){ FILE *file_r, *file_w; int c; char fileread[40]; char
filewrite
[40]; printf("Enter filename to be copied: "); gets…(file_w == NULL) { printf("Invalid Filename enter again"); fgets(
filewrite
, 40, stdin); fileread[strlen(fileread)-1] = '\0'; file_r = fopen(fileread…
1
2
3
Next
Last
Search
Search
Forums
Forum Index
Hardware/Software
Recommended Topics
Programming
Recommended Topics
Digital Media
Recommended Topics
Community Center
Recommended Topics
Latest Content
Newest Topics
Latest Topics
Latest Posts
Latest Comments
Top Tags
Topics Feed
Social
Top Members
Meet People
Community Functions
DaniWeb Premium
Newsletter Archive
Markdown Syntax
Community Rules
Developer APIs
Connect API
Forum API Docs
Tools
SEO Backlink Checker
Legal
Terms of Service
Privacy Policy
FAQ
About Us
Advertise
Contact Us
© 2025 DaniWeb® LLC