By the way, strtok allows you to tokenize strings in C, doesn't it?
Type: Posts; User: bhdavis1978
By the way, strtok allows you to tokenize strings in C, doesn't it?
I don't need to be able to identify what they entered as an specific identifier. I know that the number will always represent the variable position, and that the character that immediately follows...
Hi all,
I've got my own enum type set up as follows
typedef enum aa
{
a= 0, ala= 0, alanine= 0,
r= 1, arg= 1, arginine= 1,
nvm, figured it out with strtok. I think I just needed a break from the computer and some more sugar, caffeine and nicotine.
In case anyone is searching and finds this thread, this is how I did...
Okay, my brain is clearly fried.
Thanks BillyTKid.
What if the string is more complicated, something like
275g -> 34g 201q 202q 221s 266g 328m 334t
If there is any...
Does anybody have any snippet of code they'd be willing to share to help me parse a number and a letter from a short string that looks like this 275a into 275 and a? There isn't an explicit limit on...
Awesome tool kermit, thanks.
The glibc error was due to a really severe buffer overrun. Now I've solved the problem in the interim by making my buffers many times larger than I expect will be needed (40960 bytes), but I think I...
So I solved that problem by doing two things- linking against c99 library (which got rid of the GLIBC_2.7 not found error) and by swapping out the sscanf statement for an atof. I considered...
It seems like the problem actually might be replaced to pch, rather than to sscanf. I modified the following line
pch = strtok(buf, ",");
printf("after strtok\n");
printf("pch contains...
I completely agree with you regarding debugging. Normally when I write new routines I debug them exactly that way- one call at a time, directly from main to make sure they're working, for exactly...
Yes, it did crash at exactly the same place. I will definitely put some && k < n tests in there, that's a very good suggestion.
I'm confused why a cause and effect situation would be implied if...
Here is the code for the whole routine
float *f_retrieve_vector(char filename[], int n)
// in most cases n= 1000;
{
FILE* fp;
int k= 0;
float *f;
I'm unfamiliar with gdb, but I'm trying it anyway. Usually I just use the built in debugger in xcode, which is really helpful, but I'm unfamiliar with gdb.
Hi all,
I'm having a segmentation fault that I don't understand. The program compiles and runs just fine on any number of different Macs I've tried it on (OSX 10.5, and 10.6), but when I tried...
Hi Jorl17,
Thanks for the reply. As far as I know (which is admittedly limited), return values are limited to between -255 to 255, and the value being returned will be a float- and I won't have...
Hey all,
I would like to be able to call a python script from within a C program, and then have that python program return a single value back to the C program. One (extremely kludgy) way to do...
nevermind, nothing to see here, I'm a moron.
I've just taken a cursory glance through this, but there is a pretty fundamental error in your questions
area = ((PI)*(d_gasket^2)-(d_hole^2))/4;
In C, the ^ operator does not mean "raise to...
Hi all,
I've got a segmentation fault occurring that I don't understand, and I'd appreciate your help. First, the relevant structure
typedef struct node
{
//sequence for this node...
Thanks a lot, that helped out immensely.
Cheers,
Brad
Hi all,
I'm trying to parse out a bunch of information from a parameter input file, which I will paste below:
1000,250000,5,0,1, /Users/davis/Desktop/TEST,/Users/davis/Documents/covarion...
Yeah, I am using Xcode/gcc. I'm sure I had the version I was supposed to have- it's been working for months, and then this happened. I went to the command line and tried to compile a simple program...
Hi all,
I'm having a very strange execution error, even on extremely simple Hello, World programs.
e.g.
#include <stdio.h>
int main (int argc, const char * argv[]) {
That specific structure won't work in this case, but that's an interesting suggestion. I've come up with another idea too, which might work. It'd be slower than my matrix of matricies approach, but...