Search Results

Search: Posts Made By: limmer
Forum: Programming 01-22-2010
4,525
Posted By limmer
POST UPDATE: Thanks for the heads up on the...
POST UPDATE: Thanks for the heads up on the strlen vs sizeof. It also needs to add 1 to include the string terminator. here is the final version:
char *STRINGtoLOWERCASE(const char *IN) // converts...
Forum: Programming 01-21-2010
4,525
Posted By limmer
tolower (static pointer + malloc + realloc)
N00B here. This function would be easier using a char pointer along with free. But I wish to learn how to use char static pointers (they do not require free, right ?).

How do I erase the content...
Forum: Programming 01-16-2010
6,987
Posted By limmer
erase fread 's internal buffer ?
When fread is used twice, the second time it seems to overwrite the first time's output. Is there any way to clear fread's internal buffer after each use ?

char *FILEREAD(const char *FILENAME)
{...
Forum: Programming 01-03-2010
6,010
Posted By limmer
C: why decimals considered double by default ?
Can anybody tell me why any literal constant real numbers are double by default in C ? Why is the default not float ?
Forum: Programming 12-30-2009
3,232
Posted By limmer
Help with sscanf
sscanf does not stop at the first "&". How can I extract "doe" ?
char A[50] = "name=john&last=doe&job=vacant&";

char B[10] = "last";

char C[10] = "";

char *POINTER = strstr(A, B);
...
Forum: Programming 12-22-2009
3,526
Posted By limmer
help with sscanf
I need to match a float inside a very long string (about 5000 chars) with sscanf. (I trimmed the string in this example.) I can't seem to match all the chars that come before and after the float.
...
Forum: Programming 12-18-2009
16,883
Posted By limmer
gethostbyaddr() is deprecated in favor of...
gethostbyaddr() is deprecated in favor of getnameinfo().
Forum: Programming 12-17-2009
13,930
Posted By limmer
-Wunreachable-code is broken and has been removed...
-Wunreachable-code is broken and has been removed in gcc 4.5.

Bug report:
Bug 42406 - gcc issues warning with tolower function with optimization flag...
Forum: Programming 12-17-2009
16,883
Posted By limmer
I finally got it working: char...
I finally got it working:

char *IPtoHOST(const char *IP) // returns host name from IP address. If failure, returns IP address.
{
static char BUFFER[65] = "";

struct sockaddr_in SIN; //...
Forum: Programming 12-14-2009
16,883
Posted By limmer
gcc complains about these errors but I do not...
gcc complains about these errors but I do not understand how to solve them. In other sites I see sin_addr and sin_port not inside a structure. Passing an int to argument 1 of getnameinfo does not...
Forum: Programming 12-12-2009
16,883
Posted By limmer
get host name by IP address
I'm trying to write a function to get the host name of any given IP address.

I'm trying to follow this manual but I'm stuck. I'm using gcc and Linux. Any ideas?

getnameinfo()...
Forum: Programming 12-12-2009
13,930
Posted By limmer
Tried, but still the same warning. I tried...
Tried, but still the same warning.

I tried with gcc-4.4 (Debian 4.4.2-3) 4.4.2 and get the same error but this time repeated:



---------- Post updated at 02:05 PM ---------- Previous update...
Forum: Programming 12-12-2009
13,930
Posted By limmer
gcc (Debian 4.3.4-6) 4.3.4
gcc (Debian 4.3.4-6) 4.3.4
Forum: Programming 12-12-2009
13,930
Posted By limmer
gcc: warning: will never be executed
I get this gcc warning, but the function works correctly. Any ideas?



#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main(void)
{
char A[50] = "";
strcat(A,...
Forum: Programming 12-10-2009
1,853
Posted By limmer
help with gcc warning
I get the following gcc warning. I do not see a double being declared anywhere... how can I fix this?

(This code is just an example, I realize that the first if bracket will never be executed.)
...
Forum: Programming 11-30-2009
5,041
Posted By limmer
I tried deleting the RANDOM function and placing...
I tried deleting the RANDOM function and placing its contents inside main, then use a variable to feed the random number to the other functions. This works yet it defeats the whole purpose of using a...
Forum: Programming 11-30-2009
5,041
Posted By limmer
gcc error: #include <stdio.h> #include...
gcc error:
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <time.h>

int RANDOM(void)
{
int RANDOMNUMBER = 0;

...
Forum: Programming 11-30-2009
5,041
Posted By limmer
I've been fiddling with this for hours. I've...
I've been fiddling with this for hours. I've tried to save the random number in a variable outside a function but gcc keeps saying something like that the random number is not constant. Somehow I...
Forum: Programming 11-30-2009
5,041
Posted By limmer
Random number is not reused
I need to generate and reuse a 5 digit random number every time my program is executed. But the following generates random numbers every time the function is called.
#include <stdio.h>
#include...
9,336
Posted By limmer
Command line problems with sendmail
I cannot get this shell script to work. The path to sendmail is correct...

#!/bin/bash

echo -e "Subject: email subject\n\nemailbody" | /usr/sbin/sendmail -F fromemail@somedomain.com -t...
3,095
Posted By limmer
Thank you Mr. Pitt. I wondered why they were...
Thank you Mr. Pitt. I wondered why they were escaped! :b:
3,095
Posted By limmer
Help with echo and sed
I am using GNU sed but this does not output "what". Why?

HEY=$(echo "hey 70.70.70.70:21 what: " | sed -nr 's/.*(70.70.70.70\|71.71.71.71):(21\|22\|115\|443\|989\|990) (.*):.*/\3/p')
echo $HEY
7,553
Posted By limmer
mail or sendmail ?
1.
I need to send emails using a shell script on linux. I want to use the most widespread method (the preferred method). Is one considered deprecated in favor of the other? Which, mail or sendmail ?...
13,064
Posted By limmer
Yes, shopt was missing. :b:
Yes, shopt was missing. :b:
13,064
Posted By limmer
I tried this code but is not functional (at least...
I tried this code but is not functional (at least in bash). FILTERED still outputs the string unchanged. The second code posted does work though.


FILTERED=${STRING//@( word1| word2)/}
Showing results 1 to 25 of 29

 
All times are GMT -4. The time now is 09:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy