[Solved] heeelp, i keep getting a read underline under foreach [closed]

Using foreach on a string will produce a sequence of char, so declaring part as a string is not valid. Declare part as char or use var. do { //string test = questions[qCounter] = objReader.ReadLine(); string test = question.Split(‘?’)[qCounter]; qCounter++; foreach (char part in test) { Console.WriteLine(part); Console.ReadLine(); } } while (objReader.Peek() != -1 && … Read more

[Solved] I want to count frequency or occurrence of a every letter in a string C program

Ok here is the rewrite, the original code is better but this one might be easier to understand: #include <stdio.h> #include <string.h> int main() { char cur_char; char string[100]; int index = 0, count[255] = {0}; printf(“Enter a string\n”); gets(string); while (string[index] != ‘\0’) { char cur_char = string[index]; // cur_char is a char but … Read more

[Solved] Changing vector in function by pointer

The function does not make sense. For starters it is unclear why you are using a pointer to the vector instead of a reference to the vector. Nevertheles, this declaration vector<unsigned char> vec(5); does not reseeve a memory for the vector. It initializes the vector with 5 zero-characters which will be appended with other characters … Read more

[Solved] How to create multiplethreads each with different ThreadProc() function using CreateThread()

Try this: DWORD WINAPI ThreadProc1( LPVOID lpParameter) { … return 0 ; } DWORD WINAPI ThreadProc2( LPVOID lpParameter) { … return 0 ; } … typedef DWORD (WINAPI * THREADPROCFN)(LPVOID lpParameter); THREADPROCFN fntable[4] = {ThreadProc1, ThreadProc2, …} ; //Start the threads for (int i = 0; i < max_number; i++) { DWORD ThreadId ; CreateThread( … Read more

[Solved] How to perform bit copy in C# or byte array left shift operation

I can’t well understand your question, but here I show you how to concatenate bits. byte bits2 = 0b_000000_10; byte bits6 = 0b_00_101100; ushort bits14 = 0b_00_10110010001110; uint concatenated = ((uint)bits2 << 20) + ((uint)bits6 << 14) + (uint)bits14; uint test = 0b_00_10_101100_10110010001110; if (concatenated == test‬) { Console.WriteLine(“Ok”); } 4 solved How to perform … Read more

[Solved] IQueryable with Entity Framework – order, where, skip and take have no effect

You are not using the result of query IQueryable<StammdatenEntityModel> query = dbSet; query = query.OrderByDescending(s => s.CreateDateTime); query = query.Where(s => s.Deleted == false); if(!String.IsNullOrEmpty(keyword)) { query = query.Where(s => s.SerialNumber.Contains(keyword)); //simplified for SO } query = query.Skip(skip); query = query.Take(take); 0 solved IQueryable with Entity Framework – order, where, skip and take have no … Read more

[Solved] How to use Resources in c++? [closed]

Create an .rc file to refer to the desired embedded .exe as an RCDATA resource, eg: MYEXE RCDATA “path\to\file.exe” Add the .rc file to your project. The referred .exe file will then be compiled into your final executable. You can then access the MYEXE resource at runtime using the Win32 FindResource()/LoadResource()/LockResource() functions, or higher-level framework … Read more

[Solved] Javascript equivalent of C# code [closed]

I’m not entirely sure what you’re doing, but you could do something along these lines to enforce an agent to use particular security. var protocol = require(‘https’); var configuration = { hostname: ”, port: 443, path: ”, method: ”, secureProtocol: ‘TLSv1_2_method’ } protocol.request(configuration, context => { // Request information such as body. }); Not sure … Read more