C how to use strcat with static offset char array -


My current code looks like this (looks good on the eye but does not compile).

  Four file configs [256]; Char * pos; GetModuleFileNameA (0, FileScroll, 256); Pos = strrchr (FileConfPath, '\\'); If (pos) strcat (FileConfPath [1], "file.conf"); Second conflict (file config, "file.conf");   

2 compiler generates errors.

  Error # 2140: 'Error' in argument 1; Expected 'char * restrict' found on 'char'   

I should

  strcat (& FileConfPath [1], "file.conf");   

. It does not look right to use the addresses here

seems to be FileConfPath [1] without error, there is no error for the index specifier.

This is the correct way to keep "file.conf" After:

  strcat (& FileConfPath [1], "file.conf");   

FileSystemPath [1] is an index character; & amp; FileConfPath [1] is the character you want to pass on strcat , but the character's address is

Note that if. If you want to use the character's address after slash, i.e.

  strcpy (position +1, " file.conf ");   

It goes without saying that position + 11 (plus plus for a plus null terminator for the nine + code = "file.conf" For the characters of ) need to be equal to or less than amp and; FileConfPath [255] to avoid over the buffer limit .

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -