** Thank you so much!!
gchar *get_hash(const gchar *filepath, GChecksumType hash_type) {
FILE *fp;
if (NULL != (fp = fopen(filepath, "rb"))) {
guchar buffer[65536];
gint read_bytes;...
Type: Posts; User: sbaginov
** Thank you so much!!
gchar *get_hash(const gchar *filepath, GChecksumType hash_type) {
FILE *fp;
if (NULL != (fp = fopen(filepath, "rb"))) {
guchar buffer[65536];
gint read_bytes;...
Yes, you are right.
gchar *get_hash(const gchar *filepath, GChecksumType hash_type) {
FILE *fp;
if (NULL != (fp = fopen(filepath, "r+b"))) {
guchar buffer[65536];
...
Though I am a glib fan, I really cannot use the g_checksum_* functions to obtain an MD5 string that is compatible with the md5sum command.
gchar *get_hash(const gchar *filepath) {
FILE *fp;...
For those who might have come here looking for a solution to the original question, I have found that can be done this way or - more easily - the CDT way.
@all:
Thank you guys for the feedbacks.
I think I do really have to rethink the way I was looking at the problem when timidly abandoning the pure C89 to just enter the real world.
Yes this it.
Eclipse compiles everything and I can run the binary from a terminal window.
In fact, I would like to run my program inside the IDE that flawlessly integrates gdb, too.
@jeffcobb...
Newbie question.
Adding curses support to a C app generates the following:
Error opening terminal: unknown.as soon as it is compiled in the Eclipse IDE.
Is there a...
I would investigate the standard qsort() function that might be used like this:
qsort(Employee, elements_num, sizeof(single employee type), _Employee_cmp);
Thus you should only pay attention on...
@Salem: thank you for sharing! That's interesting indeed!
void my_func(char *[], int);
can be written
void my_func(char **, int);
as well because of C pointers and arrays nature.
Since you already know other languages, not to get bored by the same...
The following is one way of doing what you want in plain C89/ISOC90
#include <stdio.h>
#include <stdlib.h>
/* prototype */
void my_func(char *[], int);
int main(int argc, char *argv[]) {
...
Thx. It's so bad that code like the latter cannot be written like we do in other languages...
At the moment I got no time, so I will give you some code to look at instead: I usually allocate memory with this function:
char *ds_new(const unsigned int len) {
char *r;
if...
Assuming I have function f(n) that dynamically allocates n bytes/chars/...
I regularly try to wirte code like this
char *s, *s1, *s2;
s1 = f(n);
s2 = f(m);
s = concat("ss", s1, s2);...
Though I am not a C guru yet, I think that should not be a standard C way to differently manage the input.
What you are looking for should be platform and compiler specific.
Well, thx tabstop, after lunch this bit of code works completely unchanged...
Here follows a version that does not need ctype.h inclusion any more because toupper(), tolower() and isspace()...
When you code, you always have to think about the future use of it. Now you can read just numbers less than or equal to 100, because you type them and you are lazy!, but tomorrow, in real life, your...
But even if it were? Why should others care about that?
Anyway, my UDF is this:
void str_rev(char s[]) {
int c, i, j;
for (i = 0, j = strlen(s) - 1; i < j; i++, j--)
c =...
Hi all, this is my UDF
void str_capitalize(char s[]) {
char c;
int up = 1;
while (s) {
if (up) {
if (!isspace(*s)) {
c = toupper(*s);