pmsumner: (Default)
posted by [personal profile] pmsumner at 02:06am on 22/04/2002

And my head hurts.

Admittedly I spent a lot of that browsing the MSDN site looking for info on what half the classes and inbuilt functions did, but boy it's not simple. Stuff that you're doing in 3 lines in Perl takes 10 in C++. Simple stuff like splitting a chunk of text into seperate lines. In Perl:

  @lines = split /[\n\r]/, $retval;  
  # Take $retval and split it at each line break, putting result into array

In C++

while ((newloc = response.Find((TCHAR) '\n', loc)) != -1)  {  
  // Traverse "response" and look for a newline symbol

  CString frag = response.Mid(loc, newloc-loc);  
  // Copy the string between the start and the end points into "fragment"

  loc = newloc+1;
  // Increase position by one
}
One line to three, and that's a simple example. Networking code is just foul. Even using the CInternetSession:: classes, it's nowhere near as easy as Perl and it's HTTP:: / LWP:: libraries. Might be more powerful when used properly, but still... I think I need a reference book!

Reply

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

May

SunMonTueWedThuFriSat
      1
 
2
 
3
 
4
5
 
6
 
7
 
8
 
9
 
10
 
11
 
12
 
13
 
14
 
15
 
16
 
17
 
18
 
19
 
20
 
21
 
22
 
23
 
24
 
25
 
26
 
27
 
28
 
29
 
30
 
31