create an array of int which is a bit field

I'm trying to create an array which at each index i have a bit field i tried this code: struct bitF { unsigned int x1:1; ... unsigned int xn:1; }intBF; typedef struct intBF *arr[]; int main(){ int i; unsigned int *arr2[10] for(i=0;i<sizeof(arr2)/size

Bulk Insert SQL Command Can not Insert First Row

I'm using a bulk insert command for SQL Server but for some reason the first row isn't being inserted. Why can't I insert data from the first row? Is bulk insert expecting headers as default and how can i circumvent this? If I add a dummy row and set

What does int i = i & amp; 1 in the programming language C?

I got this sample code and I really do not understand how does it work. It is compiled by GCC and there are no errors at all. Also, can you please tell me what this piece of code "i = i&1" does? Thank you! int main(void){ int i; for (i = 5;

Allow only English letters and numbers in PHP

I'm trying to create a filter to allow users to use only English letters (Lowercase & uppercase) and numbers. how can I do that? (ANSI) (not trying to sanitize, only to tell if a string contain non-english letters) That filter should get me a clean d

The UPDATE syntax that works in the main databases

I want to update a table (target) based on the values present in another table (source). But I am looking for a syntax that will work in 4 major databases - Oracle, MS SQL Server, PostgreSQL, MySQL. So far, I am not able to find such a uniform syntax

Sorting a 2D array with qsort

I'm trying to sort 2d array. First i sort it by column, then by rows. Column by column is working but row by row not. What's wrong in this code? int scmpr (const void *a, const void *b){ return strcmp((const char*)a, (const char*)b); } int main(void)

Sort ANSI data from a table to a C # list

I have a problem that I really cannot get my head around. I know how to sort data in general but this one is taxing me! I have a list of values in an array. The values look like this: [03;02HTransactions [03;16HPost Transactions [04:02HDividends [04;

How to find text between two strings in c

I need to extract the text between 2 string patterns in c. Example: aaaaaa<BBBB>TEXT TO EXTRACT</BBBB>aaaaaaaaa PATTERN1=<BBBB> PATTERN2=</BBBB> Thanks.Here is an alive example of how to do this #include <stdio.h> #include &l

ANSI C - Text file: Edit a line?

I have this text file: Line 1. "house" Line 2. "dog" Line 3. "mouse" Line 4. "car" ... I want to change Line 2. "dog" in new Line 2."cards" how can I do? thanks! (sorry for my bad English)Your pr

Complex generic stack

I have been assigned to program a generic stack in ANSI C. It is meant to be for primitive datatypes. Until here there was no big problem whatsoever. Afterwards I was asked to reprogram my application so that even complex data types can be used on my

Segmentation Error - Core Error Dumped When Using getopt

I know this queston has been asked multiple times, but still I am unable to figure this out #include<stdio.h> #include<getopt.h> int ch; int queue_time=60; int thread_num=4; char *scheduling_algo="FCFS"; extern char *optarg; int port

Open an XML file and convert it to UTF-8

I'm trying to open a xml file (ansi) and converting and saving it UTF-8. Here is my code: using System; using System.IO; using System.Text; using System.Xml; class Test { public static void Main() { string path = @"C:\test\test.xml"; string path

ansi c - automatic cleaning of ugly code

I'm dealing with some code written in manner that is really, honestly, ugly. Is there a way to auto enforce proper tabs and remove all of the random multi-line white space entries?Old Unix people have a solution for everything, including lazy program

ANSI C - Tips for creating good APIs

I'm trying to create an API that is easy to use correctly and hard to use incorrectly. Imagine you had a function "bool MyObject_SetLocalDateTime(MyObject *pMyObject, params...)" which allows client to set date and time in YYYY MM DD HH MM SS fo

Is this true for ANSI C?

"The const and volatile qualifiers may precede any declaration." I saw this statement marked as true in an online test series. But in standard C(89) I can see declaration: declaration-specifiers init-declarator-listopt ; declaration-specifiers:

ANSI C - Clear a string

I've got a string declared like this: str=malloc(sizeof(char)*128); I want to clear it completely so that whenI do strncat() operation, the new characters will be written to the beginning of str. The reason I need to clear it is that I'm writing over

Dequeuing in a linked list

I'm trying to get my dequeue method working on my implementation of a LinkedList ADT. However, it is removing from the beginning of the queue instead of the end. Any help with this? I'm new to C, and am trying to port a java exercise over to C.. It's

Javascript Convert ansi to utf8

i'm trying with this plugin jquery.csvToTable to show data from csv to web page , cvs file has encoding ansi with Japanese text , but webpage has encoding utf8 , and js is not working with ansi , how is possible to convert or if exist another method

Find the WndProc address

How can I find the address of a WndProc (of a window of another process). Even if I inject a DLL and try to find it with either GetClassInfoEx() or GetWindowLong() or GetWindowLongPtr() I always get values like 0xffff08ed, which is definitely not an