[Resolved] Parsing each line read file?
Hi I am trying to read each line of my file, then put each separate line into a slot in an array.
Here is the code I am trying to use... Code:
The file contains 6 lines. I want each line into the newOrigin array. How do I do this? |
Re: Parsing each line read file?
take a look at this:
http://forums.alliedmods.net/showthr...light=parse%28 |
Re: Parsing each line read file?
Code:
|
Re: Parsing each line read file?
THREAD HIJACK !
when writeing to a file does the file have to exist already or will it create a file on its own ?:| |
Re: Parsing each line read file?
write_file() creates a file if it doesn't exist.
EDIT:I think all the new natives do the same, at least fprintf() does. |
Re: Parsing each line read file?
thank you +karma:up:
|
Re: Parsing each line read file?
Alright, now when this trys to load the lines from the file they all get set to zero (0) for some reason. The file its loading from has 6 lines. Lines 1-3 are the origin coords for one entity, and lines 4-6 are the origin coords for another entity. I am trying to load the coords from this file but they always get set to zero and my entities spawn at 0,0,0 and 0,0,0.
Here is the exact code i'm using... Code:
|
Re: Parsing each line read file?
Nevermind, I guess I still don't understand how the new file natives work. I'd wager my attempt is incorrect as well.
The 'i' isn't defined nor is it necessary. And this will not work, as it will read the first 128 characters of text and assign it to newOrigin[i]. That is not correct. Code:
This will not provide the functionality you are looking for, but as far as I know, it is correct. I never caught up with the new file natives, I still use the old ones. Code:
|
Re: Parsing each line read file?
When I use that code my console tells me to debug and it does not work at all. I really have no clue what to fix here because I still don't really understand why my code didn't work, let alone yours.
|
Re: Parsing each line read file?
Does anyone else know how to fix this?
|
| All times are GMT -4. The time now is 06:56. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.