Questions tagged as 'c'

1
answer

Difference between recv and read, send, and write

I'm transmitting and collecting data from a connection using Sockets , to send the data to the served, you can use the send and write commands, and to receive the data recv and read . Is there a difference in th...
asked by 22.11.2016 / 18:11
1
answer

Function that counts number of vector elements [duplicate]

I tried to use this function to count the number of vector elements, but it does not work. int tamanho(int *p) { return sizeof(p) / sizeof(int*); } I wanted to pass for : i< tamanho(vetor) . That's how it worked:...
asked by 03.10.2016 / 14:49
1
answer

Function that reads a double from a string and returns the remainder of the string in C

Is there any function of the type? Which reads and stores or returns a double of a string and returns or passes the rest of the string pointer or will I have to do my own function? If no one has ideas how to do this function optimally?     
asked by 03.10.2016 / 21:55
1
answer

How to pass the field of a struct to a function in a part library?

Hello, everyone. I have a program that has a struct like this: struct itemDeLista{ char nomeProd[10]; float quant; float vUnit; int item; }; But I need to count the number of letters in the str...
asked by 19.08.2016 / 04:11
1
answer

How to get the Package Name of an Android application in a C library?

I'd like to know how I can get the Package Name from my Android APP via a library written in C . What I want to get is the following com/meu_app/mainframe/MainActivity or com.meu_app.mainframe.MainActivity of the class that is...
asked by 07.08.2016 / 04:36
1
answer

Change place characters - C

I need to write a program in C that takes a string as a parameter and generates a new string consisting of the original string with the following changes:    ● The first character of the string must be placed at the end of the string;      ...
asked by 08.08.2016 / 18:39
1
answer

GtkListStore, invalid string type

The code is giving an invalid string format error when passing from GtkComboBoxText to a GtkListStore . Pango-WARNING **: Invalid UTF-8 string passed to pango_layout_set_text () struct _list_prod{ GtkListStore *store; GtkWidget *...
asked by 20.09.2016 / 22:00
1
answer

Segmentation Fault in Double-chained Lists

I have a problem with the implementation of double-chained lists, my code is as follows: #include <stdio.h> #include <stdlib.h> struct MoveList { int curRow, curCol, newRow, newCol, isEat; struct MoveList *next, *prev; };...
asked by 21.07.2016 / 18:13
1
answer

What's the difference between these two means of getting the PackageName?

I have these two code snippets, the two display the same result, so I would like to know what the difference is between them. 1 jclass cls = (*env)->FindClass(env, "android/content/ContextWrapper"); jmethodID mid = (*env)->GetMethodID...
asked by 15.08.2016 / 23:51
2
answers

How to make a local variable in C (or C ++) global?

Can I make a local variable turn into global, even though it's inside a function? In C language or even C ++ if it does not exist in C. I have already seen something of the type in Java, but I do not know exactly how it works.     
asked by 19.06.2016 / 18:50