Search Results

Showing results 1 to 36 of 36
Search took 0.01 seconds.
Search: Posts Made By: andor ; Forum: C and child forums
Forum: C Feb 9th, 2007
Replies: 3
Solved: C file stream
Views: 5,573
Posted By andor
Yes. With fopen, SEEK_END and ftell you can determine the size of file and after SEEK_SET read the the whole file with fread.


#include <stdio.h>
#include <stdlib.h>

int main()
{
char *...
Forum: C Jan 26th, 2007
Replies: 2
Solved: New
Views: 914
Posted By andor
I'm not shore that I understood your problem.

#if 0
/* you can put here anything and the compiler wouldn't consider it */
#else
/* while this part will be considered */
#endif /* if 0 */
Forum: C Nov 22nd, 2006
Replies: 9
Views: 1,679
Posted By andor
#include <stdio.h>
#include <string.h>

int one_less(char *);
int main()
{
char s[20];
printf("Type string\n");
scanf("%s", s);
printf("number of changes made is...
Forum: C Nov 21st, 2006
Replies: 9
Views: 1,679
Posted By andor
With something like this:

if ((a[i] > '0') && (a[i] <='9'))
{
a[i] -= 1;
}

In the loop.
One remark about your code. You are not obtaining the string the right way. Read this...
Forum: C Oct 27th, 2006
Replies: 2
Views: 3,567
Posted By andor
Variable answer is float not int. Instead of printf("%d",answer); use printf("%f",answer); instead. Dont use nonstandard func (use them only if your teacher explicitly demanded). You need a getchar...
Forum: C Oct 25th, 2006
Replies: 12
Solved: Gone Loopy in C
Views: 1,978
Posted By andor
Ok while U're here just to report that the posts order are different for internet explorer and for firefox.
EDIT: is that a bug?
Forum: C Oct 25th, 2006
Replies: 12
Solved: Gone Loopy in C
Views: 1,978
Posted By andor
WHAT!?!? Okay use this

int main()
{
/* your code going here */
return 0;
}
Forum: C Oct 25th, 2006
Replies: 12
Solved: Gone Loopy in C
Views: 1,978
Posted By andor
Ah nice didn't know that it exist ([code=c]). :sad:
Forum: C Oct 25th, 2006
Replies: 12
Solved: Gone Loopy in C
Views: 1,978
Posted By andor
Um you need a main func. Where did you declared the age variable?

do
{
/* stuff */
} while(/*your code going here */);

This is a do while loop, not

do
Forum: C Oct 25th, 2006
Replies: 12
Solved: Gone Loopy in C
Views: 1,978
Posted By andor
Did you copile this? Use [ CODE] [ /CODE] tags.
Forum: C Oct 25th, 2006
Replies: 6
Views: 1,597
Posted By andor
Also you can do it with string.

len = sprintf(buff, "%d", num);

for (i=0; i<len; i++)
{
printf("%d\n", buff[i] - '0');
}

Where num is in your case 1567.
Forum: C Oct 20th, 2006
Replies: 14
Views: 4,562
Posted By andor
Declare the both globals as locals inside the main func.

int transfer_sequence (char * initial_sequence, char * fix_sequence);
int check_gene (char * fix_sequence);
int main()
{
char...
Forum: C Oct 19th, 2006
Replies: 14
Views: 4,562
Posted By andor
If you using scanf than:
input: G (hit enter) X (hit enter) your output GX
If using getchar
input: GX your output GX.

#include <stdio.h>

int main()
{
int sequencetemp;
Forum: C Oct 18th, 2006
Replies: 2
Solved: void pointer
Views: 3,062
Posted By andor
What part U dont understand? The void pointer? Well void pointer can be used if you are not shore which type will be passed to func compare.
BTW const void must be separated.
Forum: C Oct 18th, 2006
Replies: 14
Views: 4,562
Posted By andor
sorry I didn't read your post carefully. I asume that U must use scanf, so then U must. Ok the problem is your loop. Dont increment x every time.
Check this

for ( x = 0; x < 511; ) { /* x < 511...
Forum: C Oct 18th, 2006
Replies: 14
Views: 4,562
Posted By andor
For obtaining single char you can use getchar which returns int. You can read this (http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1044652485&id=1043284385) and this...
Forum: C Oct 8th, 2006
Replies: 2
Solved: until help
Views: 774
Posted By andor
No it dose not exist. Replace it with

do
{
/* your code going here */
} while(a<b);
Forum: C Oct 6th, 2006
Replies: 19
Views: 3,887
Posted By andor
Convert cust_num to string for example with sprintf.

char buff[MAX];
sprintf(buff, "%d", cust_num);
fputs(buff, fpr);
/* and for fputc */
fputc(cust_num + '0', fpr); /* suposing that cust_num...
Forum: C Oct 5th, 2006
Replies: 19
Views: 3,887
Posted By andor
It means how many of size_t_Size you want to write.
fwrite(buff, sizeof(int), 4, someFile) means you want to write four ints to file.
Forum: C Sep 30th, 2006
Replies: 10
Solved: need some help
Views: 2,291
Posted By andor
Use code tags (http://www.daniweb.com/techtalkforums/announcement8-3.html) and don't use void main (read this (http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1044841143&id=1043284376))
Forum: C Sep 29th, 2006
Replies: 10
Solved: need some help
Views: 2,291
Posted By andor
With which part do you have problem? Formula for conversion or programming issue? For formulas, read this (http://www.google.com/search?hl=en&lr=&q=formula+temperature+conversion&btnG=Search). For...
Forum: C Sep 26th, 2006
Replies: 5
Views: 2,567
Posted By andor
>error C2061: syntax error : identifier 'scanf'
it means you need ( before scanf.
>I still have to figure out why my average value is coming out wrong.
Did U read my post?
>What would be the best...
Forum: C Sep 26th, 2006
Replies: 5
Views: 2,567
Posted By andor
You are not calculating the total gallons after first gallon input before while, and after finishing the prog you are substacting from total gallons -1.
Forum: C Sep 11th, 2006
Replies: 3
Solved: C Quest 2
Views: 1,029
Posted By andor
#include <stdio.h>
#include <stdlib.h>

int func();

int main()
{
short mat[3][3],i,j;

for(i = 0 ; i < 3 ; i++)
Forum: C Sep 1st, 2006
Replies: 3
Views: 1,318
Posted By andor
First of all fflush(stdin);won't do the work!
Read this (http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1044873249&id=1043284392) and this...
Forum: C Aug 28th, 2006
Replies: 15
Views: 4,282
Posted By andor
#include <iostream>
#include <cstdlib>
#include <string>

using namespace std;
void decToBin(int number, int base);
int numOnes = 0;

int main()
{
Forum: C Aug 28th, 2006
Replies: 15
Views: 4,282
Posted By andor
Ok here it is

for (unsigned int i=0; i<name.size(); i++)
{
cout << name[i] << " binary (";
decToBin(name[i], 2);
cout << ")" << endl;

char tmp[2] = { 0, 0...
Forum: C Aug 24th, 2006
Replies: 15
Views: 4,282
Posted By andor
A litle of help. In your for loop you can make a temp array wich will convert the name[i] to decimal with atoi.

char tmp[2] = { 0, 0 };
tmp[0] = name[i];
answer = atoi(tmp);


Figure this out
Forum: C Aug 24th, 2006
Replies: 15
Views: 4,282
Posted By andor
This is illegal. What did you want with this line?
Forum: C Jun 29th, 2006
Replies: 10
Views: 2,649
Posted By andor
#include<stdio.h>
#include<stdlib.h>

main()


{

FILE *fp;
char buffer[]="STEPHEN";
Forum: C Jun 28th, 2006
Replies: 9
Views: 1,243
Posted By andor
AH yes you are totaly right but I used it becouse the string length is very short in this case.
Forum: C Jun 28th, 2006
Replies: 9
Views: 1,243
Posted By andor
Don't understand what you trying to tell (my english is far from perfect) but whats wrong with strlen. You mean don't use it in for loop?
Forum: C Jun 28th, 2006
Replies: 9
Views: 1,243
Posted By andor
#include <string.h>
#include <stdio.h>

int main()
{
int num = 123;
int i, result;
char buff[11], temp[2] = {0, 0};

sprintf(buff, "%d", num);
Forum: C Jun 28th, 2006
Replies: 9
Views: 1,243
Posted By andor
Here is an idea. Convert to char *
Forum: C Jun 24th, 2006
Replies: 11
Solved: while loop
Views: 3,884
Posted By andor
A little bug just change the Exit func to

void * Exit(void * ptr)
{
char c;
while (1)
{
scanf("%c", &c);

if ( c == 'e')
Forum: C Jun 24th, 2006
Replies: 11
Solved: while loop
Views: 3,884
Posted By andor
This is just an idea how can solve your problem


#include "stdio.h"
#include "pthread.h"

pthread_t threadEvent;
unsigned char breakLoop = 0;

void * Exit(void * ptr)
Showing results 1 to 36 of 36

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC