943,832 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 6081
  • C++ RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Nov 27th, 2005
0

Re: Searching a file for a string

Quote originally posted by perniciosus ...
About color check, Ancient Dragons post, that was what I was talking about...
very similar to code tags but use color tags insted
[ color = <color here> ] and [ /color ]
(remove the spaces from the above)

Example in red
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,951 posts
since Aug 2005
Nov 27th, 2005
0

Re: Searching a file for a string

Quote originally posted by perniciosus ...
no need to redo what has already been done
grep -n word file
or to use it in that context once you got the string do
C++ Syntax (Toggle Plain Text)
  1. char *arg[5] ;
  2. arg[0] = "grep" ; arg[1] = "-n" ; arg[2] = string.c_str() ; arg[3] = fileName.c_str() ;
  3. arg[4] = NULL ;
  4. execvp(arg[0], arg) ;
(Your not using unix, when do one ever use console apps in windows ? go fetch mingw and tools )
If you think about 5 minutes before you knew this trick this post wouldn't be very helpful.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
pokerponcho is offline Offline
10 posts
since Nov 2005
Nov 27th, 2005
0

Re: Searching a file for a string

Quote originally posted by pokerponcho ...
If you think about 5 minutes before you knew this trick this post wouldn't be very helpful.
What I'm saying is that you shouldn't try to make someone feel bad for not knowing what you already learned. There once was a time where you were the same way.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
pokerponcho is offline Offline
10 posts
since Nov 2005
Nov 27th, 2005
0

Re: Searching a file for a string

Hey, I was very thankful when I got to know about exec, now that is a convenient system call...
Reputation Points: 29
Solved Threads: 4
Junior Poster in Training
perniciosus is offline Offline
78 posts
since Nov 2005
Nov 27th, 2005
0

Re: Searching a file for a string

Quote originally posted by perniciosus ...
And I dont consider producing code that could just as well be copy pasted from just about any project showing that he has tried to understand or solve the problem...
Well...determining this, is subject to the individual's intelligence so I need not comment.
Quote originally posted by perniciosus ...
and if you read his post you se that he says nothing about what operating system he is using, so I could just as well assume he was using linux and was nice enough to point out what to do if he was not...
What a valid assumption. Now it is all beginning to make sense. :rolleyes:


Quote originally posted by perniciosus ...
]Mind solving this one:
You guys I was given a task to solve the integer factorization problem efficiently, preferable using the general number field sieve, mind helping me out (look code, I have made an effort)..
C++ Syntax (Toggle Plain Text)
  1. #include <iostream>
  2. #include <string>
  3. int main( int argc, char **argv )
  4. {
  5. std::string number ;
  6. std::cout << "What number do you want to factorize: " ;
  7. std::getline( std::cin, number ) ;
  8. std::string factors ;
  9. // so I'm stuck here, I could use some help implementing the general number field
  10. // sieve, perferable in a easily paralizable manner so that I can use all my
  11. // availible computers to solve the problem...
  12. // ofcourse if you have a faster algorithm for 100+ digits numbers I would appreciate
  13. // an implementation of that as well....
  14. std::cout << number << " factors into " << factors << std::endl ;
  15. return 0 ;
  16. }
Saw that the question does not show genuine effort :cheesy: . Also I dont know the Alogorithm too. Better to say you dont know rather than make whatever reply you can think of.
/end retort
Moderator
Reputation Points: 572
Solved Threads: 115
Mentally Challenged Mod.
WolfPack is offline Offline
1,559 posts
since Jun 2005
Nov 28th, 2005
0

Re: Searching a file for a string

Well the point was that neither do I, and I am not likely to understand a solution you provide me with even if it was richly documented... From the code given it looked like he had gotten so far as to get a file name and a string to search for, and this would be a solution to the problem stated... He probably learned as much from my answer as from copy pasting what ever someone else neatly wrote down and perhaps error checked that fit directly into his code...

And of course lastly, all hail the BOFH...
Reputation Points: 29
Solved Threads: 4
Junior Poster in Training
perniciosus is offline Offline
78 posts
since Nov 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Please make my frist socket app work...
Next Thread in C++ Forum Timeline: Linked List & Objects





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC