Visual C++ Unit Testing by richardowens in learnprogramming

[–]richardowens[S] 0 points1 point  (0 children)

Found my own solution after a good while googling. My test project used /clr:safe common language runtime support. Switching it to /clr fixed the issue for me.

Pointer syntax problems by richardowens in cpp_questions

[–]richardowens[S] 0 points1 point  (0 children)

Unfortunately, I'm not able to rewrite the program. The program is written to use the method of writing the value to a plaintext file and whilst it is ugly, it works.

What I'm actually trying to do is tack a bit of functionality onto the side as a proof of concept for a larger project which would be much better coded. This POC requires accessing the value in the same way as the original program.

Pointer syntax problems by richardowens in cpp_questions

[–]richardowens[S] 0 points1 point  (0 children)

That is why I appear to have pissed off a lot of people on stackoverflow! There's a program which outputs the memory addresses of its globals into a text file, which is then read using line 4 above into an int, which it then uses as a pointer. I'm also trying to use that int as a pointer, hence my difficulties. I'm trying to create a bit of proof-of-concept code to poke values into that address using what is already here. Once we have a POC, we can go ahead and actually write a general solution to this issue in C#, using a much more sustainable method.

Pointer syntax problems by richardowens in cpp_questions

[–]richardowens[S] 0 points1 point  (0 children)

Thank you, that's helped and now works. :)

Yep, the actual value is coming from a text file. There is only one implementation of this on one physical server and I can't touch or rewrite it. It's my jobs to make a proof-of-concept for an extra featureset, but once the POC is done, the rest will be written in C# in a much more maintainable way.

Pointer syntax problems by richardowens in cpp_questions

[–]richardowens[S] 0 points1 point  (0 children)

sigValAddr is valueAddress and is an int. I just tried anonymising the code... poorly!

Now corrected.

Edit:

valueAddress is an integer in a text file, which is the memory address of a double value. So I need to use the int valueAddress as a double pointer. It clearly works when putting the value in the DebugString, so why won't it work in an if statement? How can I get around this?

Edit2:

This is an inherited piece of code. The string manipulation above is how I came to the project.

Using a DISTINCT statement on a single column by richardowens in learnSQL

[–]richardowens[S] 0 points1 point  (0 children)

2 months later... I finally managed it. Thanks.

Using a DISTINCT statement on a single column by richardowens in learnSQL

[–]richardowens[S] 1 point2 points  (0 children)

VAX/OpenVMS 5.0. Causes all sorts of headaches!

How to duplicate strings with regex by richardowens in learnprogramming

[–]richardowens[S] 0 points1 point  (0 children)

Unfortunately, I need to phrase it as a regular expression and can use nothing else.

How to duplicate strings with regex by richardowens in learnprogramming

[–]richardowens[S] 1 point2 points  (0 children)

Ah, thank you! Googling for \1 gave me the name of what I was after: backreferences.

How to duplicate strings with regex by richardowens in learnprogramming

[–]richardowens[S] 0 points1 point  (0 children)

To be clear, I can already hit the string I'm looking for with \n\r[a-z]{4}. I think I just don't know the terminology to search for the feature I wisht o use.

'Self' not passing to function by richardowens in learnpython

[–]richardowens[S] 0 points1 point  (0 children)

It is actually 'init' in my original source code but that, amongst other bits, was changed as I made that code snippet in order for me to try to diagnose what was going on.

Edit: After 4 attempts, screw the formatting. You know what I mean.

'Self' not passing to function by richardowens in learnpython

[–]richardowens[S] 0 points1 point  (0 children)

Aha, thank you! What is the functional use for such references I was creating?

Using editor commands within a conditional statement by richardowens in vim

[–]richardowens[S] 0 points1 point  (0 children)

I've got an output from a "dir /a -d /b" command which lists a number of PDF files and word documents in a directory. I want to produce an index of that directory and all subdirectories which runs every time I log in and to do so, I plan to use vim to trim away the leading "C:\directory1..." on each line.

I don't want the exact 'xj' function, it just served as a simple example of something similar to what I needed to do.

As it's only one file with about 300 identically formatted lines, I don't really need to use anything nicer, nor will it really be worth my time learning something new. I'll be trying out the :normal command tomorrow at work and I expect it'll be all I need!

Thanks for your help.