liliafan 53 Junior Poster

What you have written as an example looks correct. Your error message suggests a different issue at work? Perhaps the function find_keyword does not take a const string?

You are right :o)

The actual call I was making was

void test_class(keyword_cache &test)
{
   test.find_keyword("black");
}

It was translating the "black" at a char array not a string.

Thanks for the help.

Ben

liliafan 53 Junior Poster

Hi

I am attempting to pass a reference to an object from one function to another, is this even possible, if so what is the syntax this is an example of what I want:

class SomeClass {
   public:
      int a = 100;
};

void second_function(SomeClass & ref_to_classobj)
{
   std::cout << ref_to_classobj.a << endl;
}

int main()
{
   SomeClass classobj;
   second_function(classobj);
   return 0;
}

Obviously the functions and classes I am using are a lot more complicated the class itself in the program I am writing takes about 5 seconds to construct due to it dealing and containing a huge amount of data. I don't want to have to reinitialise this class everytime I use it I want to just be able to point a reference to it. Does anyone know how to do this?

I have tried the method above, also:

void foo(SomeClass &reference)
void foo(SomeClass *reference)

and about 10 other variations on this, the usual error message I get is:

no matching function for call to `keyword_cache::find_keyword(const char[6])'

Any help will be greatly appreciated.

Thanks

Ben

liliafan 53 Junior Poster

Sorry it took so long to reply I have been install freebsd and haven't had a chance to boot to linux.

Okay whenever I attempt to click on a search that is supposed to popup the layer with the search textbox, it fails with no explaination, on checking the javascript console, there is no explaination please note it isn't just the search button, thread tools, rate thread, search thread, display modes all display the same behaviour.

This is the specs:
Linux neo 2.4.21-215-athlon #1 Tue Apr 27 00:53:38 UTC 2004 i686 athlon i386 GNU/Linux

Mozilla Firebird 0.6.1+

HTH
Ben

liliafan 53 Junior Poster

I am aware that there are some problems with Linux/Firebird and the dropdown menus. I am working on debugging this. May I ask what used to happen when you previously clicked the Search link?

Nothing at all the link failed to perform any action at all, this happened with:

SuSE 9.0 (Kernel 2.4.20) + Firebird 0.7 and 0.8
Gentoo 1.4 (Kernel 2.4.22) + Firebird 0.7 and 0.8

HTH
Ben

liliafan 53 Junior Poster

Another alternative is to take the source for Mozilla Firebird (open source) make a few customisations to the source (graphics logos) and compile it for internal use. I don't think there would be licensing issues since it is open sourced anyway.

alc6379 commented: GREAT idea! +36
liliafan 53 Junior Poster

Much more compatible with Linux/Firebird (before I couldn't use the search).

liliafan 53 Junior Poster

I am reading an very interesting book regarding religion which contains a number of references that can be checked back as factual, no doubt the author is using a lot of artistic leaway but I recommend it to anyone with doubt about religion, or anyone that doesn't quite "buy" what most religions preach. "The Da Vinci Code", whilst it is listed as fiction, the historical references in it are mostly true, or where not true are the basis for supposition for many people.

liliafan 53 Junior Poster

Ludootje - I am not having to write that much code over :o) The wonderful thing about knowing what the end product will be is that you can write more efficient code, you can also eradicate uneeded code, and in addition some language handle things better than others, where as all the caching code in the project written in perl came to about 900 lines dealing with the different caches and different methods of access by using C++ and SDL that is reduced to about 100 lines.

liliafan 53 Junior Poster

Ludootje - Yes generally compiled languages are better for the bigger projects, the project I mentioned does in fact prove that point (I am in the process of recoding it in C++), however, sometimes a project starts being a lot smaller than it ends up, with perl you end up with spagetti code that is almost impossible to read, very difficult to reference and often buggy and breakable, however, python sounds like it may fit this niche quite well, something that starts as a small project but has potential to grow into something a lot larger, it looks to me like python will grow quite well with any project.

So long story short, yes bigger projects often are more suited to compiled languages (although not always), but small projects that at first seem perfect for a scripted language can often grow, a good example of that was a bash / perl set of scripts I wrote to simply monitor a machine for load getting to high and sent out some mail if it got severe, started as a couple of hundred lines in about 3 scripts, ended up being a full distributed network monitoring program which is still being added to everyday at the moment it has something like 6000-8000 lines of code across about 50 files, across 6 midsize sun enterprise servers, in hindsight it should have been written in C/C++ for scalability but at the time, I had an hour on my hands and wrote a couple …

liliafan 53 Junior Poster

Ludootje - Excellent article, it certainly has got me thinking.
acl6379 - Your statement combined with reading the article from Ludootje, has made up my mind. I am gonna play with python, this is no small statement perl is my first language I have been using it for 6-7 years and I always hated the look of python, but perhaps it has a few positive features, especially considering the timing, I just wrote a project in perl with >5000 lines of code and it broke after 3 months because the interpreter couldn't handle the load, perhaps python will be more successful.

Ben

liliafan 53 Junior Poster

Python has been looking interesting to me for a few years, i even went as far as buying an oreilly book on it, but so far it hasn't progressed up my list of languages to learn which as it stands at this point is:

ksh
ruby
Ocaml
python
java

Java is another language I have been thinking about learning but I really don't want to, it goes against my grain C/C++, perl, however, I have a horrible feeling someone is going to offer me a project in the near future using java and I will have to turn it down, being a freelance coder sucks sometimes the clients gets to have to much input on the language to be used.

This is besides the point, acl6379, how do you find python compares to other scripted languages, perl, ruby, etc, I have only ever heard the opinions of perl and python fanatics who always say their language is best I have yet to hear an objective opinion.

Ben

liliafan 53 Junior Poster

Okay I managed to figure it all out, I will still contact the author to get a better long term solution for a fix I have the following:

cp /sys/modules/ndis.ko /boot/modules
cp /sys/modules/if_ndis/if_ndis.ko /boot/modules

echo ndis_load="yes" >> /boot/loader.conf
echo if_ndis_load="yes" >> /boot/loader.conf
echo hw.ndis0.SSID="default" >> /boot/loader.conf

vi /etc/rc.conf

(add:

ifconfig_ste0="inet 192.168.0.1 netmask 255.255.255.0"
ifconfig_ndis0="inet 192.168.1.50 netmask 255.255.255.0"

)

Upon reboot both cards have valid ipv4 inet addresses assigned along with inet6 addresses, both card can be accessed without a problem.

If I attempt to assign the 3rd nic card an address in rc.conf the whole thing breaks but this isn't really a problem considering that card is there purely as a backup if ste0 breaks xl0 can be assigned the address.

I hope this solution can help someone in the future, I managed to figure it out after re-reading my last post it is amazing what you can figure out when you get a chance to lay out your thoughts in text lol.

Thanks for the help alc6379 :-) when I find out a permanent solution I will also post that here.

Ben

liliafan 53 Junior Poster

alc6379 - I actually also tried the up statement on the ifconfig command (I tried about 10 variations).

I am thinking perhaps it is something to do with the rc files, strange as that may sound, since during boot up there seems no problem assigning ipv4 addresses to nic cards (I have 3 cards in this machine 2 ethernet 1 wireless), the first nic card gets an address assigned at boot time it works perfectly, the 2nd nic card doesn't get anything assigned I am using this as a control card, the third nic I attempt to assign an address to after boot (it is the wireless card), if I attempt to assign an address to the 2nd card after boot it will only assign an ipv6 address same with the third card, additionally if I bring the first card down and reassign an address to it, it will only get an ipv6 address assigned.

To me this implies that somehow the inet module is loading at boot for the boot assignment but somehow being unloaded after boot but being kept in memory for the existing card? So I figure a good solution would be to somehow assign everything to the wireless card during boot, so I am looking for some kind of pointer as to how to I can assign ssid and wep during boot?

I know in the long term I need to get a better solution and for this I will take your advice …

liliafan 53 Junior Poster

Hi

I managed to get freebsd 5.2-Current up and running which is cool I managed to get project evil up and running, however, I can't assign and ipv4 address assigned to the card:

ifconfig ndis0 inet 192.168.1.50 netmask 255.255.255.0 ssid default wepmode on wepkey 0x(key)

when I do an ifconfig ndis0 the inet address is missing but the inet6 address is there.

I just tried to assign an ipv4 address to another card (ethernet) and it did the same thing, but if I set rc.conf to assign an address to the ethernet card during boot it works fine, this would be an option for ndis0 if i could only figure out how to assign ssid and wep stuff during boot too.

Any ideas why there would be a problem with ipv4 addresses?

Thanks

Ben

liliafan 53 Junior Poster

acl6379 - Okay I managed to get freebsd 5.2-Current up and running which is cool I managed to get project evil up and running, however, I can't assign and ipv4 address assigned to the card:

ifconfig ndis0 inet 192.168.1.50 netmask 255.255.255.0 ssid default wepmode on wepkey 0x(key)

when I do an ifconfig ndis0 the inet address is missing but the inet6 address is there.

Any ideas?

Thanks

Ben

liliafan 53 Junior Poster

Ludootje - It can be done in perl very easily, and since primarily I am a perl programmer that would be my tool of choice.

opendir(TMP, "/adirectory");
while ($f=readdir(TMP)) {
   if (-d $f) {
      $directory++;
   } else {
      $file++;
   }
   $total++;
}
closedir(TMP);

Obviously just counting files this is a lot of work but in my experience if you are counting files and directories in real world situations you are going to do something with this output, which is where perl comes in handy.

In regards to the bash statements, I couldn't remember the syntax for "test"ing so I used the man pages and on the system I was on at the time (openBSD 3.2) that is the method described. The arithmatic functions in bash suck bad since if the syntax isn't 100% correct it will fail and often not even say that it has failed, I only used it because I was trying to use internal shell as much as possible and avoid external commands where I could. In terms of speed and real world usage for just counting your method is faster and more efficient.

Ben

liliafan 53 Junior Poster

alc6379 - I finally have a couple of quite days ahead, so I downloaded freebsd 5.2.1 (most recent I had before was 5.1), and I am going to try using NDISulator, and see if I can get it working, if you have any tips on configuring it please feel free to send them ;-) I looked on google but I couldn't find anything worthwhile, no sign of that how to, I can gonna try and bluff my way through and see how that goes it usually works.

Thanks for the advice, oh btw I tried the bridging with win 2003 and decided I really don't like 2003 period which is why I am attempting to get the card working with bsd.

Thanks
Ben

liliafan 53 Junior Poster

Hey "Unregistered"

Well Father, Son and Holy Spirit are all one and the same, they are part of the trinity, therefore, whilst being seperate to us, to God they are all him, so for company it is basically like having multiple personalities lets face it you can't keep yourself company forever.

In regards to someone who can watch everything, that is just it isn't it, watching, how long can you watch without wanting real interaction, in the event that God created everything, then do you not notice that in everything there is partnerships from animals, to fish, to insects, to people, to stars and planets, to galaxies there is interaction everywhere, there is a theme in all of it, nothing in the universe is completely by itself it doesn't work.

How long can you sit at a window and watch the world passing by before you want to get involved, or perhaps how long can you watch a messageboard before you want to say something? Watching isn't the same as interacting, if God doesn't mind being alone then surely his creations wouldn't mind being alone.

Nope as I see it God wants company so he created a spirit as big as himself and divided it amongst all life, so the spirit once it has experienced everything can be a partner to God.

I don't expect everyone to agree with me in fact based on my theory and beliefs no one should agree 100% with me …

Yzk commented: most enlightening... +17
liliafan 53 Junior Poster

You are right that would be a simpler method of doing it, but since it sounded a lot like a homework assignment I was hoping to just give an indication of how it could be done, whilst indicating that there was better ways to do it, rather than giving the answer in the simplest possible way :o)

liliafan 53 Junior Poster

Paladine: What can I say I spend a lot of time thinking about the great beyond.

liliafan 53 Junior Poster

I believe in God 100% I completely disbelieve in religion, I do however believe it is required, all the bad things that happen in the world are supposed to happen just as much as the good, because we as a species are supposed to experience everything that can be experienced. I believe God is bored and wants an equal, so all life in existance is there to become his/her equal, God created everything therefore has experienced everything, all life is of one spirit that is supposed to experience all things so that God has a companion, I imagine infinity is a lonely place if you have no one to talk too.

And by birth and upbringing I am catholic, I have read the bible, I just believe religion is inherently evil, and that if God is in all things then we can talk to him wherever we choose, not in an old building with some guy telling us how bad we are.

Besides there must be some truth in it all most of the religions of the world have the same basic beliefs; one God, don't kill. However since most of them like to fight and disagree so much so be it.

liliafan 53 Junior Poster

Have you thought about FreeBSD for the router?

FreeBSD has a project called NDISulator (aka Proiject Evil) that tries to adapt Windows wireless drivers to FreeBSD. I've got an ADMtek 8211 chipset card which has no native driver, but works great with NDISulator.

Hmmm I would love to use a Unix to do my routing, I am somewhat of a windows hater, do you have a link to where I can read up more on NDISulator? It sounds pretty interesting, also is it just freeBSD specific or do you know if openBSD supports it, that is my *nix of choice.

Thanks

Ben

liliafan 53 Junior Poster

Interesting... could have sworn 2000 could do it...

What model Wireless NIC do you have, liliafan? Linux or a *BSD might have okay support for it.

I have a linksys WMP59G (I think that is the code, I don't have the spec in front of my right now) and no linux doesn't support it but linuxant driverloader is supposed to support it, but I did quite a bit of testing with the linuxant drivers and a whole bunch of hacking with configs and stuff but it would only operate as a 802.11b card which gave me a max throughput of 11mbps using windows 2000 (as much as a hate to my home is almost 100% linux) I can get it operating as a 802.11g card with a throughput of about 45mbps at this range.

I couldn't find any documentation on whether *BSD would support it.

I will take a look at bridging, I have windows XP and windows 2003 available, and I was planning on messing with the router box in a couple of days anyway so I will experiment do you have any good links on how to set up bridging?

Thanks

Ben

liliafan 53 Junior Poster

Dump the fox-whatever.There are alot of such stuff which have no future. Get rid of Bloodshed also.I have used it and some standards are not supported.Borland Command line complier (they give that for free) is much
better.

What don't you like about bloodshed? I have used it a bit and quite like it, I prefer it over Visual C++ 6, and so far as standards are concerned it is basically GNU GCC 2.95 (last time I checked) ported to windows which is very standards compliant.

liliafan 53 Junior Poster

The following script shows show I would do it, this is with a script instead of the commandline, of course in reality I would use perl but this is a basic idea on how to use bash to do it.

#!/bin/bash

directory=0
file=0
total=0

for a in `ls`
do
   if test -d $a; then
      directory=$(($directory+1))
   else
      file=$(($file+1))
   fi

   total=$(($total+1))
   echo $a

done

echo Total directories: $directory
echo Total files: $file
echo Total: $total

Of course if this is in fact a homework assignment the included code wouldn't get you a good grade it is intended just to show basically how it is done.

It can be pasted into a file and then run with: sh scriptname.sh

HTH

Ben

liliafan 53 Junior Poster

Yeah, I've heard that linux isn't quite "with it" when it comes to the wireless side of things.

It is just basic NAT though.

Feigned excellent links :-) I had been working on it all day yesterday, today I followed the instructions on those pages and it was up and running within 30 minutes.

Linux is lacking behind in wireless networking only because the hardware vendors don't release drivers for linux and it is up to the linux community to produce their own drivers which obviously takes a little time, for them to figure out the hardware etc, however, if you can get the drivers in my personal opinion (personal tastes do vary) linux provides a more stable and easier interface to this kind of task.

Anyway thanks again for the help

Ben

liliafan 53 Junior Poster

REG_DWORD HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\IPEnableRouter = 1

Hey TKS, I have already set the registry values, that was the first thing I did, but still it isn't working.

feigned I just printed the 2 reference links you gave me I am going to try that now.

I miss linux, I set up ip forwarding in 20 minutes before, but unfortunatly the wireless card I have doesn't support linux properly, even using the linixant driverloader, the best connection I can get is 11mbps which on a wireless-g card is terrible, so I am left having to fight against windows.

Thanks both of you for the advice.

Ben

liliafan 53 Junior Poster

Hi

I am not sure if anyone can help with this is it a pretty big problem.

Basically I have just moved my home office to my garage, in order to link to the dsl router in the house I have upgraded the router to a linksys wireless router.

I have a machine in the garage with windows 2000 advanced server installed, I want to use this machine as a gateway between the machines in the garage and the router in the house.

I have set up the machine with a 802.11g wireless pci card which is connected just fine to the router in the house, and a 10/100 ethernet card which is connected to the switch in the shed which all the machines are linked to.

Now I want all the machines in the garage to use the windows 2000 gateway to link to the dsl router.

I have tried using 2 distinct networks:

192.168.1.0 / 255.255.255.0 in the house
192.168.0.0 / 255.255.255.0 in the garage

I then set up all my machines in the shed on the 192.168.1.0 subnet with a gateway set as 192.168.0.1 (the windows 2000 machine) I also installed the windows routing and remote access in the 2000 machine, and set the registry to enableipforward. This failed.

I tried to have both networks on the same subnet this failed.

I tried setting static …

liliafan 53 Junior Poster

Hi,

C++ is a superset of C.

I can only wonder WHY you would want to try to compile something that works with C only? That doesn't make sense.

Christian

I seemed to remember reading about some incompatibilities that were valid C and not C++ code after doing a few minutes googling I found this link:

http://david.tribble.com/text/cdiffs.htm

Whilst most of the incompatibilities exist only in theory between the ISO99 standard C and C++ there does exist some problems such as:

extern int foo();

void main()
{
   foo(1,2);
}

Is valid C but will cause an error in C++, in 2 places with g++ since main must return an int, and there is too many arguements passed in foo, in C it is assumed that extern int foo() calls a function with an unspecified number of arguements where as C++ assumes it is called a function with no arguements ie: extern int foo(void)

So whilst there shouldn't be incompatibilities some do exist due to language evolution.

Btw most of the incompatibilities on the link included are theoretical also with some compilers the incompatibility I have shown will be detected with others it won't according to the standard it is invalid C++ but valid C, and when I tested this will gcc and g++ it showed the problem.

HTH
Ben

liliafan 53 Junior Poster

Hey, I just became a member. This is a nice website.

So my question is what are the difference between OpenBSD and FreeBSD...They both seem to be about the same. Thanks for the help (if i get any).:)

Since I have little experience with both I can only comment based on my experiences and things I know are common knowledge.

FreeBSD is designed to be more user friendly than openbsd, it is also more key towards developers and desktop users.

OpenBSD is much more secure, supposedly the most secure BSD available if not the most secure operating system in the world, only one vulnerability found in the last 7 years in the default install.

They also both have totally different branches of development which means each will have code and features that the other is missing.

All BSD's come from the same orginial sources but they have all branched off into seperate development trees to support different things and be keyed towards different tasks.

I am sure there is a major BSD geek going to give you a much more detailed answer than that but from my understanding and limited knowledge (I have been running openbsd for a year on 2 servers and freebsd on and off from about 3 years but I haven't ever gone into more detail in learning beyond what I needed to know to do the tasks at hand).

HTH anyway

Ben

liliafan 53 Junior Poster

Use string.h

strcmp(str1,str2);

returns 0 if they are equal

Note this will only work with c strings, if you want to use this function with string you will need to treat them as c style strings ie:

if ((int a = strcmp(stringa.c_str(), stringb.c_str())) == 0) {
   cout << "Match" << endl;
} else {
   cout << "No match" << endl;
}

With c++ I find it is easier to compare the strings with:

if (stringa == stringb) {
   cout << "Match" << endl;
} else {
   cout << "No match" << endl;
}

HTH
Ben

liliafan 53 Junior Poster

Also would you call MS Access and MySQL an application or a software

What do you mean by application or software, all applications are software.

Access isn't a database, it is a frontend for an external database server, and it deals with database type files, it isn't a true database though, mysql on the otherhand is a true database, so if you are planning on doing anything with any level of complexity I recommend mysql.

liliafan 53 Junior Poster

Those are some great links, I have been doing quite a bit recently with map and a little stuff with vector, but beyond using the named array functionality I have done much investigating, good stuff.

Thanks
Ben

liliafan 53 Junior Poster

actually, the STL containers may in fact be implemented with btrees, but that is transparent to you the programmer. u just stick the elements in and let them worry bout the implementation, and when u pop them out it will always be in linear time. for your strings u could just use a simple vector.

Excellent time for me to invest some more research into STL, since the most important factor in this is speed perhaps STL is the best option I think perhaps I will make out some test code this afternoon to speed check it, if that isn't up to what I need I can always go back and try and impliment my own B-trees later, you are right though STL is there why reinvent the wheel (yes you can tell I usually code perl :op )

Thanks

Ben

liliafan 53 Junior Poster

blud, that's what I am confused about. Suppose one installs an old release. And then keeps up to date with all packages, including recompiling the kernel. What is the difference between that and upgrading to a newer release as a package?

Some of the core software isn't up to date, I have a machine running Suse 6.4 from about 5 or 6 years ago, there is software that won't run on that version without serious headaches, for example yast2 the suse installer and configuration manager wont run I still use yast, installing would be possible but it would mean a large number of conflicts and difficulties updating links and libraries.

It is possible to run an machine with all the software the same as the most recent version of a distro but so long as it was installed from an old version people will usually refer to that version.

I have another machine in my house running suse 8.2 I most of the packages are newer than the most recent version of suse (9.0) however it is still running suse 8.2 just because that is the version I installed.

There is sometimes other differences for example filesystems or layouts may change package managers may change.

Perhaps it is easiest to say I run linux version 2.4.20 on Suse 9.0 or Slackware 9.0 or whatever distro you use.

Ben

liliafan 53 Junior Poster

The best place to get any information on linux on laptops is:

http://www.linux-laptop.net/

HTH

Ben

liliafan 53 Junior Poster

you're better off using the STL if you can, their algorithms are far superior to what most of us could write.

By using STL, do you mean maps vectors etc and avoiding btrees?

Thanks

Ben

liliafan 53 Junior Poster

You can also use style sheets:

<html>
<head>
<style>
body {
   background: colour name or hex value;
}

for tables:

table {
   background: colour name;
}
</style>
</head>

You can also link to external style sheets.

liliafan 53 Junior Poster

classic rock, alternative rock, modern rock, and pretty much anything else except pop, hip hop and harcore.

collective soul
the who
matchbox twenty
creed
genesis
eric clapton
silverchair

are some of my favourites.

liliafan 53 Junior Poster

Excellent I have a good book covering how to build well balanced B-Trees so I guess tonight in bed I will be reading up on those chapters.

I am using g++ 2.95 as the compiler on Solaris 8 sparc, and intel and linux 2.40.20 on x86 all of which support profiling I believe, so I will check that out.

Thanks for the advice :o)

Ben

liliafan 53 Junior Poster

Hi

I am needing to store some data for a project I am working on, I am trying to figure out the fastest method to access the stored data, the data takes the form:

keyword (std::string) - list of ints

ie:

yellow - 2342 2312 8478 3827 9773 4837 2893 0983 478 2981, etc

I need to store this information in a memory based cache, size isn't really in issue the machine this will be running on has 8g of ram of which I can freely use about 2g.

I am thinking a Btree would be best and then store the ints in a vector, ie:

Btree node yellow:
vector<int>
vector<int>

More background this is a searchengine previously written in perl, which came up against some obvious limitations when it started getting >10 hits a second, it is being reimplimented in C++ to remove some of the limitations of perl.

The data was previously stored in a large hash of arrays:

$hash{yellow} = (int, int, int, int, int, int, int);

So data was retreived pretty quickly.

I am looking at about 2000 keywords and about 3000 ints which can repeat in different keywords, when a request is made I need to be able to pull all the ints in the requested keyword.

I will be able to figure out the code without too many problems I am just looking for some recommendations on the most …

liliafan 53 Junior Poster

NP glad to help.

Ben

liliafan 53 Junior Poster

That yields the same problem that I was having:

%%A was unexpected at this time.

Hmmmm running on windows XP that works fine, what version of windows are you using?

Additionally is this from a bat file or are you testing on the commandline? On the command line %%A becomes %A.

From checking for / do on commandline requires an NT class OS.

liliafan 53 Junior Poster

wc -l <file> counts the number of lines in a file
wc -w <file> counts the numbers of words in a file
wc -c <file> counts the number of bytes in a file
wc -m <file> counts the number of characters in file

You can combine with other commands ie:

ls | wc -l will count the number of files in the current directory.
cat /etc/passwd | wc -l will count the number of entries in /etc/passwd

liliafan 53 Junior Poster

Hi I think the following should work:

SET DOMAIN=mydomain.com
FOR %%A IN (ServerA ServerB ServerC ServerD) DO xhost +%%A%.%DOMAIN%

You may need to play with it a little to get it working exactly right but that is the basic syntax.

HTH

Ben

liliafan 53 Junior Poster

hi, u seem to know quite a bit about C++ ( i dont know anything!) could you explain what this problem may be (nobody else can...)

"Runtime Error!

program C:\program files\maxis\the sims\sims.exe

Abnormal program termination"

Hi

This really isn't related to C++ in anyway, other than perhaps the programmers used C++ to write this program, I would suggest you contact their technical support department and ask for help there. Runtime error in windows could mean anything, there is a million combinations of things that could cause this.

All the best
Ben

liliafan 53 Junior Poster

sub filter_begin ()

I can't find anywhere in your script where this is being called, therefore it wouldn't do anything.

# Subject check
    my($msgSubject);
    my($hfile) = "HEADERS";
    while(<HEADERS>) {
        chomp;
        $line = $_;
        $idx = index($line, "Subject: ");
        if (idx == 0){
                $msgSubject = substr($line, 9);
        }
    }

You are assigning the value "HEADERS" to $hfile, so:
print $hfile;

would print HEADERS.

If you are trying to read the value of a file, I would suggest passing it as an array, and doing:

foreach $line (@file) {

instead of

while(<HEADERS>) {

Either that or open the file in the function:

open(HEADERS,"filename.txt");

while(<HEADERS>) {

Or pass the file handle to the function:

filter_begin("subject", *HEADERS);

sub filter_begin {
my ($blah, $handle) = @_;

while(<$handle>) {

Sorry if this isn't very clear I haven't been awake long.

HTH
Ben

liliafan 53 Junior Poster

Are you talking about Matt Wrights Formmail.pl ? If so I recommend http://nms-cgi.sourceforge.net/
not matts scripts, written by the London.pm perl mongers to be secure drop in replacements to Matt Wrights scripts.

liliafan 53 Junior Poster

C++ is computer language ,for creating windows programs

Note not just windows programs visual c++ is aimed just at windows but C++ itself will work on any platform that a compiler has be written for or ported to.

liliafan 53 Junior Poster

Okay I have solved the problem, one of the other files in this program is using pthreads. which means I am linking with -lpthread, which includes its own thread safe version of strtok_r(), which does return an int value, however, by passing -D_REENTRANT to the compiler it uses the strtok_r in string.h instead of the one from the pthread library.

It is supposed to be a known problem in solaris (but if it is well know it is very well hidden).

Thanks for the help all the same.

Ben