inherit
27278
0
Aug 3, 2024 9:13:18 GMT -8
Josh
Apple iManiac / eBay Addict
12,347
July 2004
jwd41190
|
Post by Josh on Nov 17, 2010 13:33:56 GMT -8
Is it possible to read a file from the beginning and the end at the same time in C++? The reason why I am asking is because I have a file with over 200,000 words and I am trying to figure out the best and fastest way to read and store them in my program.
|
|
inherit
106478
0
Dec 31, 2010 20:50:17 GMT -8
xcessive
291
June 2007
xcess
|
Post by xcessive on Nov 19, 2010 17:18:43 GMT -8
You could try multi threading. Or you could do something like..
(the following is pseudocode, so don't rage at me and tell me its not valid C) for int i 0 to lengthOfFile/2 read(file) read(file[length-i]) endfor
I think you'll find however that multi threading would be the fastest way to do this.
|
|
inherit
27278
0
Aug 3, 2024 9:13:18 GMT -8
Josh
Apple iManiac / eBay Addict
12,347
July 2004
jwd41190
|
Post by Josh on Nov 19, 2010 23:16:16 GMT -8
You could try multi threading. Or you could do something like.. (the following is pseudocode, so don't rage at me and tell me its not valid C) for int i 0 to lengthOfFile/2 read(file ) read(file[length-i]) endfor
I think you'll find however that multi threading would be the fastest way to do this.Ok, thanks man thats all I needed to know
|
|
inherit
130228
0
Jul 11, 2024 19:19:59 GMT -8
Charles Stover
1,731
August 2008
gamechief
|
Post by Charles Stover on Nov 22, 2010 19:20:26 GMT -8
You could try multi threading. Or you could do something like.. (the following is pseudocode, so don't rage at me and tell me its not valid C) for int i 0 to lengthOfFile/2 read(file ) read(file[length-i]) endfor
I think you'll find however that multi threading would be the fastest way to do this.Is that some BASIC? o.O
|
|
inherit
27278
0
Aug 3, 2024 9:13:18 GMT -8
Josh
Apple iManiac / eBay Addict
12,347
July 2004
jwd41190
|
Post by Josh on Nov 22, 2010 19:59:25 GMT -8
You could try multi threading. Or you could do something like.. (the following is pseudocode, so don't rage at me and tell me its not valid C) for int i 0 to lengthOfFile/2 read(file ) read(file[length-i]) endfor
I think you'll find however that multi threading would be the fastest way to do this.Is that some BASIC? o.O You talking about VB(Visual Basic?) It is just psuedocode that can be used for any language I would assume...but I was asking about C++
|
|
inherit
106478
0
Dec 31, 2010 20:50:17 GMT -8
xcessive
291
June 2007
xcess
|
Post by xcessive on Nov 23, 2010 18:10:27 GMT -8
You could try multi threading. Or you could do something like.. (the following is pseudocode, so don't rage at me and tell me its not valid C) for int i 0 to lengthOfFile/2 read(file ) read(file[length-i]) endfor
I think you'll find however that multi threading would be the fastest way to do this.Is that some BASIC? o.O en.wikipedia.org/wiki/Pseudocode
|
|
inherit
130228
0
Jul 11, 2024 19:19:59 GMT -8
Charles Stover
1,731
August 2008
gamechief
|
Post by Charles Stover on Nov 23, 2010 22:24:10 GMT -8
I know what pseudocode is. I was just noting that it looks a lot like BASIC. That is, I was wondering if he wrote it having had experience with BASIC but not C++, hence formated it as such as opposed to for(x; y; z){}.
|
|
inherit
106478
0
Dec 31, 2010 20:50:17 GMT -8
xcessive
291
June 2007
xcess
|
Post by xcessive on Nov 24, 2010 0:20:40 GMT -8
I know what pseudocode is. I was just noting that it looks a lot like BASIC. That is, I was wondering if he wrote it having had experience with BASIC but not C++, hence formated it as such as opposed to for(x; y; z){}. I said at the top of my post it was pseudocode. I am fairly well versed in C++ but the pseudo-code seemed more concise and language portable + I'm pretty lazy.
|
|
inherit
130228
0
Jul 11, 2024 19:19:59 GMT -8
Charles Stover
1,731
August 2008
gamechief
|
Post by Charles Stover on Nov 24, 2010 8:01:38 GMT -8
I know it was pseudocode.
Yours: for int i 0 to lengthOfFile/2
BASIC: For i as int = 0 To lengthOfFile/2
They're very similar. Hence I was asking if the pseudocode was influenced by BASIC as opposed to being completely made up. Jeez.
|
|
inherit
106478
0
Dec 31, 2010 20:50:17 GMT -8
xcessive
291
June 2007
xcess
|
Post by xcessive on Nov 24, 2010 16:44:41 GMT -8
I know it was pseudocode.Yours: for int i 0 to lengthOfFile/2 BASIC: For i as int = 0 To lengthOfFile/2 They're very similar. Hence I was asking if the pseudocode was influenced by BASIC as opposed to being completely made up. Jeez. Ok, well you weren't being very clear so don't be upset you didn't get a clear answer. My pseudocode would probably heavily influence by Blitzmax because I find the syntax really easy. (http://en.wikipedia.org/wiki/Blitz_BASIC) Although I don't think you'll find a catch all file read function like "read()" in any language haha.
|
|
inherit
130228
0
Jul 11, 2024 19:19:59 GMT -8
Charles Stover
1,731
August 2008
gamechief
|
Post by Charles Stover on Nov 27, 2010 6:21:05 GMT -8
PHP has file_get_contents('file-name.txt') which reads the entire file. I <3 PHP.
|
|