[Solved] Error When using a Macro in C++ to validate an IP

If you really want to implement this as a macro then you need to remove the return from inside the macro. You can’t assign the “result” of your macro to a variable as it is not a single statement. #include <cstdio> #define IPV4_ZEROVAL_CHECK(ip, result) {int d1,d2,d3,d4; result = (4 == sscanf(ip, “%d.%d.%d.%d”, &d1, &d2, &d3, … Read more

[Solved] Member name same as class name [closed]

You don’t have to make the member names match the SQL column names. If you’re using some kind of ORM, there’s almost always a way to specify the mapping explicitly. For ADO.Net, obviously you’re free to use the names as appropriate. I’d rename the member NoteText. I’d also consider applying the same change in SQL, … Read more

[Solved] C++ Probllem with output [closed]

You should be able to just use string concatenation with +. mfile.open ( accname + “.txt”); If you are not on c++ 11, then you probably need a C-style string. mfile.open ( (accname + “.txt”).c_str()); 5 solved C++ Probllem with output [closed]

[Solved] Disable startup program in registry; [closed]

You can set a program at startup like that: private void SetStartup() { RegistryKey rk = Registry.CurrentUser.OpenSubKey (“SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run”, true); rk.SetValue(“Notepad”, “c:\windows\notepad.exe”); } Now if you want to remove it then just edit the path slightly. rk.SetValue(“Notepad”, “c:\windows\notepad.exe_”); Later on if you want to reset it, just remove the underscore. 4 solved Disable startup program in … Read more

[Solved] confusing sizeof operator result

if I count correctly, part 1 is 9 byte long right ? No, you are counting incorrectly. 0x0200000001 can fit into five bytes. One byte is represented by two hex digits. Hence, the bytes are 02 00 00 00 01. 1 solved confusing sizeof operator result

[Solved] c#–how to set a pic in html element in webBrowser [closed]

As far as i understand you want to see your picture right after you upload it on your web page. Try this: <div class=”form-group”> <label for=”Photo”>Photo</label> <input type=”file” id=”Photo” name=”Photo” onchange=”show(this)” /> </div> <img id=”onLoad” src=”#” alt=”qwerty”> <script> function show(input) { if (input.files && input.files[0]) { var reader = new FileReader(); reader.onload = function (e) … Read more

[Solved] Iterating through a generic list property

Use var here, the compiler than will decide in the foreach loop from which type the SearchItem in the list is. In this example var is of type string/ SearchViewModel<string> vs = new SearchViewModel<string>(new List<string> { “1”,”2″,”3″}); foreach (var item in vs.SearchItems) { // logic, item in this case is string } solved Iterating through … Read more

[Solved] how to convert char in octal format without standart C functions like print(f) [closed]

Decimal and octal are number bases, this only matters when presenting a number (or when inputing a number); the actual number is generally stored in binary in the computer’s memory but this doesn’t often matter to typical programs. In your case, conversion to octal generally involves extracting three bits at a time (since 23 is … Read more

[Solved] returning string in C function [closed]

The idea is not that bad, the main errors are the mix-up of numerical digits and characters as shown in the comments. Also: if you use dynamic memory, than use dynamic memory. If you only want to use a fixed small amount you should use the stack instead, e.g.: c[100], but that came up in … Read more

[Solved] Confusing and unexpected behaviour of “if” statement in C [closed]

You didn’t copy the program correctly. This is the real program that reproduces the bug: #include <stdio.h> #define TRUE 1 #define FALSE 0 int function_returning_false() {return FALSE;} int main() { if (function_returning_false) { // note, no () printf(“function returned true\n”); } } So, it’s not calling the function – it is passing the function as … Read more